Skip to main content

Partition Function Calculator

Solve partition function problems step-by-step with our free calculator. See formulas, worked examples, and clear explanations.

Share this calculator

Formula

p(n) = number of ways to write n as a sum of positive integers

The partition function p(n) counts unordered representations of n as sums of positive integers. The Hardy-Ramanujan asymptotic formula approximates p(n) as (1/(4n*sqrt(3))) * exp(pi*sqrt(2n/3)). Dynamic programming computes exact values efficiently.

Worked Examples

Example 1: Computing p(10) - Partitions of 10

Problem: Find the number of ways to partition the integer 10 into sums of positive integers.

Solution: Using dynamic programming:\ndp[0]=1, then add each part size 1 through 10.\nAfter processing all parts: dp[10] = 42\nSome partitions: 10, 9+1, 8+2, 7+3, 7+2+1, 6+4, 6+3+1, ...\nDistinct-part partitions: 10, 9+1, 8+2, 7+3, 7+2+1, 6+3+1, 5+4+1, 5+3+2, 4+3+2+1 = 10\nOdd-part partitions: also 10 (Euler identity confirmed)

Result: p(10) = 42 | Distinct parts: 10 | Odd parts: 10 | Hardy-Ramanujan estimate: 48

Example 2: Verifying Ramanujan Congruence p(5n+4) mod 5 = 0

Problem: Check that p(4), p(9), p(14), and p(19) are all divisible by 5.

Solution: p(4) = 5 = 5 * 1\np(9) = 30 = 5 * 6\np(14) = 135 = 5 * 27\np(19) = 490 = 5 * 98\nAll are divisible by 5, confirming the congruence.

Result: p(4)=5, p(9)=30, p(14)=135, p(19)=490 - all divisible by 5

Frequently Asked Questions

What is the partition function p(n) in number theory?

The partition function p(n) counts the number of distinct ways a positive integer n can be written as a sum of positive integers, where the order of summands does not matter. For example, p(4) = 5 because 4 can be partitioned as 4, 3+1, 2+2, 2+1+1, and 1+1+1+1. The function grows extremely rapidly: p(10) = 42, p(50) = 204,226, and p(100) = 190,569,292,356. The partition function was studied extensively by Euler, Hardy, Ramanujan, and Rademacher, and it connects to deep areas of modular forms, combinatorics, and representation theory. It has applications in statistical mechanics and quantum physics.

What is Euler distinct-odd partition theorem?

Euler proved that for any positive integer n, the number of partitions into distinct parts equals the number of partitions into odd parts. For example, for n = 5: the distinct partitions are 5, 4+1, 3+2, giving 3 partitions; the odd-part partitions are 5, 3+1+1, 1+1+1+1+1, also giving 3. This elegant identity can be proven using generating functions, where the generating function for distinct partitions is the product of (1+x^k) for k = 1,2,3,..., which equals the product of 1/(1-x^(2k-1)), the generating function for odd partitions. This identity is one of the foundational results in the theory of integer partitions and combinatorial identities.

What are Ramanujan congruences for the partition function?

Ramanujan discovered remarkable divisibility patterns in the partition function. He proved that p(5n+4) is always divisible by 5, p(7n+5) is always divisible by 7, and p(11n+6) is always divisible by 11. For example, p(4) = 5, p(9) = 30, p(14) = 135, and p(19) = 490 are all divisible by 5. These congruences were later understood as consequences of deep properties of modular forms. Ken Ono and others extended these results, showing that for any prime m >= 5, there are infinitely many congruences of the form p(An+B) divisible by m. These discoveries reveal that the partition function has hidden periodic structure governed by modular arithmetic.

What is the rank and crank of a partition?

The rank of a partition, defined by Freeman Dyson in 1944, is the largest part minus the number of parts. Dyson conjectured that the rank modulo 5 and modulo 7 would explain Ramanujan first two congruences, which was later proved by Atkin and Swinnerton-Dyer. However, the rank fails to explain the modulo 11 congruence. To resolve this, Dyson hypothesized a statistic he called the crank, which was eventually discovered by Andrews and Garvan in 1988. The crank is defined as the largest part if no 1s appear in the partition, or as the number of parts larger than the number of 1s minus the number of 1s. The crank modulo 5, 7, and 11 simultaneously explains all three Ramanujan congruences.

Is Partition Function Calculator free to use?

Yes, completely free with no sign-up required. All calculators on NovaCalculator are free to use without registration, subscription, or payment.

Does Partition Function Calculator work offline?

Once the page is loaded, the calculation logic runs entirely in your browser. If you have already opened the page, most calculators will continue to work even if your internet connection is lost, since no server requests are needed for computation.

References