Integer Partition Generator
Generates a random partition of a small whole number, from 6 to 20, into positive whole-number parts that add back up exactly to the total — one way of writing that number as a sum, out of what can be an enormous number of possible ways, for an introduction to combinatorics or a quick number puzzle.
What this generator does
Produces a way of writing a number as a sum of positive whole numbers. Partitions are a classic combinatorics topic and useful for splitting a total into parts in puzzles and test data.
How to use this tool
- Press generate for a random integer partition.
Worked examples
- Format
- 9 = 1 + 3 + 3 + 2, 17 = 9 + 3 + 5 and 9 = 9 — three consecutive draws; a single part equal to the whole is a valid partition
Common use cases
- Introducing the concept of number partitions
- Quick maths puzzles
- Teaching examples for combinatorics
How this generator works
The partition is built by repeatedly drawing a whole number between 1 and whatever remains of the total, subtracting it, and continuing until nothing is left — so the parts appear in the order they were drawn, not sorted from largest to smallest. Because a large first draw is exactly as likely as a small one, this method reaches some partitions of a given number far more often than others rather than sampling every partition uniformly.
Limitations and good to know
- The tool returns one partition, not all of them. The number of partitions grows extremely fast — 50 already has more than two hundred thousand.
Related generators
- Knapsack Problem Generator0/1 knapsack instances solved exactly by dynamic programming, with the value-per-weight answer shown alongside for comparison.
- Geometric Sequence GeneratorA random geometric sequence with a whole-number ratio.
- Percentage Split GeneratorSplits 100% into three random parts that always add up correctly.
- Random Partition GeneratorSplits a whole number into random parts that add back up to it exactly, with no part rounded away.