Integer Partition Calculator and Partition Generator
Choose an integer
Partition result
Enter n and select Calculate partitions.
For example, p(5) = 7 because 5 has seven unordered additive partitions.
Advertisement
What is an integer partition?
An integer partition of a non-negative integer n is a sum of positive integers equal to n. Repetition is allowed, but order is ignored. The summands are called parts.
The generator writes parts from largest to smallest. That convention makes equivalent sums such as 3 + 2 and 2 + 3 appear once, as 3 + 2.
The seven partitions of 5
5
4 + 1
3 + 2
3 + 1 + 1
2 + 2 + 1
2 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1
Therefore, p(5) = 7.
How the exact count is calculated
The calculator uses Euler’s recurrence from the generalized pentagonal number theorem. It starts with p(0) = 1 and treats p(m) as 0 whenever m is negative.
The signs occur in pairs: +, +, −, −, and so on, using offsets 1, 2, 5, 7, 12, 15, …. Exact arbitrary-size integers are used, so the count is not rounded. Complete lists are generated separately by backtracking through non-increasing parts.
Small partition-number values
| n | p(n) | Interpretation |
|---|---|---|
| 0 | 1 | One empty partition, written ∅ |
| 1 | 1 | 1 |
| 4 | 5 | Five unique unordered sums |
| 5 | 7 | Seven unique unordered sums |
| 10 | 42 | Forty-two unique unordered sums |
| 100 | 190,569,292 | Counting is practical; listing is not |
Integer partition FAQ
What is an integer partition?
It is a way to write a non-negative integer as a sum of positive integers where order does not matter and parts may repeat. For example, 3 + 2 and 2 + 3 are the same partition of 5.
What does p(n) mean?
The partition function p(n) counts the unrestricted integer partitions of n. For example, p(5) = 7.
Why is p(0) equal to 1?
There is one partition of zero: the empty partition, shown as ∅. This convention makes partition recurrences and generating functions work consistently.
Are different orders counted separately?
No. Integer partitions ignore order. The generator writes parts in non-increasing order so each partition appears exactly once.
Are integer partitions the same as compositions?
No. Order matters for compositions, so 3 + 2 and 2 + 3 are different compositions. Order does not matter for integer partitions.
Why can the calculator count higher values than it can list?
Partition counts grow very quickly. The exact recurrence supports n through 10,000, while complete list generation stops at 40 to keep memory use, file size, and response time reasonable on mobile devices.
Does the tool upload or track my integer?
No. Counting, generation, copying, and file creation happen locally in your browser. The calculator does not send the entered integer to a backend or add it to the page URL.
