Integer Partitions Calculator

Enter a number to count its integer partitions.

How it is calculated

The tool counts partitions p(n): ways to write n as a sum of positive integers, ignoring order, so 3+1 and 1+3 are the same. It builds a table with the coin-change recurrence: start with p(0) = 1, then for each part size k = 1, 2, …, n update p(j) = p(j) + p(j − k) for j from k up to n. After all part sizes are used, p(n) is the answer. Input is rounded to the nearest whole number, and only 0 to 250 is accepted; anything above gives no result. p(0) = 1 by convention. Counts grow fast, p(100) = 190,569,292, and p(250) = 230,793,554,364,681 is still shown exactly. It counts partitions, not lists them.

Worked example

Take n = 6. Allowing parts of size 1, 2, …, 6 step by step, the table ends with p(6) = 11. Listing them confirms it: 6; 5+1; 4+2; 4+1+1; 3+3; 3+2+1; 3+1+1+1; 2+2+2; 2+2+1+1; 2+1+1+1+1; 1+1+1+1+1+1. That is 11 distinct sums. For comparison p(10) = 42, so the count roughly quadruples while n goes from 6 to 10.

Try this example →

Common mistakes

  • Counting orderings as different partitions. 4+1+1, 1+4+1 and 1+1+4 are a single partition; counting ordered sums gives compositions, which are far more numerous (2n−1).
  • Forgetting the single-part partition. The number n itself counts as one partition (6 alone).
  • Entering a decimal and expecting it to be rejected. The value is rounded, so 7.6 is treated as 8.
  • Entering n above 250. The tool gives no result there, not an approximation.
  • Confusing partitions into distinct parts or into exactly k parts with p(n). This tool counts all partitions with no restriction.

About this calculator

A partition of a positive integer n is a way of writing it as a sum of positive integers where order doesn't matter — for example, 4 can be partitioned as 4, 3+1, 2+2, 2+1+1, or 1+1+1+1, giving p(4) = 5. This calculator computes p(n) with a dynamic-programming recurrence that counts all such distinct sums, for any n from 0 to 250.

Mathematicians and combinatorics students use partition counts as a foundational topic in number theory, and the underlying recurrence appears in computer science too — competitive programmers implement partition-counting algorithms for problems involving coin-change combinations, generating functions, and other combinatorial counting tasks.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    The count p(n) treats 3+1 and 1+3 as the same partition, so it measures ways to split n identical items into piles, not ordered sums. It grows fast: p(10) is 42 while p(100) is 190,569,292. Inputs run from 0 to 250 and decimals are rounded to the nearest whole number. What problem led you to partitions?

Popular calculators

All Calculators