Maths & numbers

Integer partition count calculator

Count ways to write an integer as a sum of positive integers with order ignored.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

The calculation accumulates contributions by permitted part size. This prevents counting reorderings as new partitions.

THE FORMULAMultiply the generating factors 1/(1−xᵏ) up to degree n

A 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.

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.

The five unordered partitions of four are displayed as rows of decreasing positive parts14231322421151111
Part order is ignored. The five rows exhaust the partitions of four, while the default input seven has 15 partitions.

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.

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.

Find your calculator

Start typing to explore the library.