Calculators

Partition Number Calculator

Calculate exact integer partition numbers p(n) for 0 to 1000 privately in your browser, with the digit count and next term.

Count the ways to add up to a whole number with exact BigInt arithmetic. Your data stays in your browser.

Enter a whole number from 0 to 1000 using digits only. Zero has one empty partition. Five has seven: 5, 4+1, 3+2, 3+1+1, 2+2+1, 2+1+1+1 and 1+1+1+1+1.

Your partition number will appear here.

Count the ways to write a number as an unordered sum.

The partition number p(n) counts the ways to write the whole number n as a sum of positive whole numbers, where the order of the parts does not matter. For n = 5 the seven partitions are 5, 4+1, 3+2, 3+1+1, 2+2+1, 2+1+1+1 and 1+1+1+1+1, so p(5) = 7. By convention p(0) = 1 counts the empty sum. The sequence starts 1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42. The calculator uses Euler’s pentagonal number theorem recurrence: p(m) alternates adding p(m − k(3k − 1) ÷ 2) and p(m − k(3k + 1) ÷ 2) with sign (−1)^(k − 1) for k = 1, 2, 3 and so on, skipping terms whose index would be negative. Unlike Bell or Stirling numbers, which partition sets of distinct items, this counts partitions of a single integer into indistinguishable parts. Enter a whole number from 0 to 1000 using one to four digits; leading zeros and surrounding whitespace are accepted, while signs, decimals, separators and scientific notation are rejected. Exact BigInt arithmetic preserves every digit. All calculations stay in your browser.

Frequently Asked Questions

Everything you need to know about this tool, how it works, and privacy.

What does a partition number count?

The partition number p(n) counts the ways to write the whole number n as a sum of positive whole numbers where order does not matter. For n = 5 the seven partitions are 5, 4+1, 3+2, 3+1+1, 2+2+1, 2+1+1+1 and 1+1+1+1+1, so p(5) = 7. By convention p(0) = 1 counts the empty sum.

How are partition numbers calculated?

This calculator uses Euler’s pentagonal number theorem recurrence. Each p(m) is built from earlier values p(m − k(3k − 1) ÷ 2) and p(m − k(3k + 1) ÷ 2) with alternating signs, skipping terms whose index would be negative. Exact BigInt arithmetic preserves every digit, so no rounding occurs.

How do partition numbers differ from Bell and Stirling numbers?

Bell and Stirling numbers count partitions of a set of distinct items into groups: Bell numbers allow any number of groups, while Stirling numbers of the second kind fix the group count. Partition numbers instead split a single integer into indistinguishable parts, so only the sizes of the parts matter, not which parts are which.

Which inputs are supported?

Enter a whole number from 0 to 1000 using digits only. Leading zeros and surrounding whitespace are accepted, while signs, decimals, thousands separators and scientific notation are rejected with a clear error.

Are results exact and private?

Yes. The calculator uses browser BigInt arithmetic for exact results from 0 to 1000, including values far beyond ordinary floating-point precision. No inputs are uploaded or stored. Copy result copies the number, digit count, next term and method.