How this calculation works
The calculation accumulates contributions by permitted part size. This prevents counting reorderings as new partitions.
Multiply the generating factors 1/(1−xᵏ) up to degree nA worked example
7 has 15 partitions. The expressions 3 + 4 and 4 + 3 count once.
Good to know
The empty partition of zero counts once.
Reference: NIST DLMF, Functions of Number Theory (opens in a new tab) ↗
Ignore the ordering of positive summands
An integer partition expresses a nonnegative total as an unordered sum of positive integers. For four, the five partitions are 4, 3 + 1, 2 + 2, 2 + 1 + 1 and 1 + 1 + 1 + 1. Swapping 3 + 1 to 1 + 3 does not add a new partition.
The default input seven has 15 partitions. The implementation builds these counts incrementally. For each allowed part size k, it updates totals using partitions that can include k. Processing part sizes in a fixed order prevents the same collection of parts from being counted again in a different order.
Distinguish total partitions from fixed-size splits
This calculator allows any number of positive parts. If the number of parts must be fixed, that is an additional restriction and the total partition count will generally be too large. The Integer composition count calculator fixes a part count but treats ordering as meaningful, giving another distinct counting problem.
Zero parts are excluded. Allowing arbitrary zeros would permit indefinitely many written expressions for the same positive-part partition. The input zero has one empty partition, providing the initial count used by the recurrence. Partition totals grow quickly, so the output is retained as an exact integer string rather than rounded to a floating-point approximation.
Read more: NIST DLMF integer partitions (opens in a new tab) ↗
A few questions, answered
Are repeated parts allowed?
Yes. The partition 2 + 2 of four is valid. Requiring distinct parts defines a different partition count.
Does the output list the partitions?
It returns the total count. The small example in the article and diagram illustrates the ordering convention.