Partition Function Calculator
Work out the number of ways to write n as an unordered sum from n. P(n) by Euler's pentagonal recurrence, with p(0) = 1, and the page prints the substitution so the result can be checked by hand.
Partition Function Calculator
Work out the number of ways to write n as an unordered sum from n. P(n) by Euler's pentagonal recurrence, with p(0) = 1, and the page prints the substitution so the result can be checked by hand.
How this page computes
P(n) by Euler's pentagonal recurrence, with p(0) = 1
p(4) = 5 because 4, 3+1, 2+2, 2+1+1 and 1+1+1+1 are the same five partitions however the terms are ordered. That is the difference between a partition and a composition.
Euler's recurrence uses the pentagonal numbers and alternating signs, and every term is a whole number, so the count is exact.
The calculation runs entirely in this browser tab; nothing is uploaded.
Partition Function Calculator computes the number of ways to write n as an unordered sum. P(n) by Euler's pentagonal recurrence, with p(0) = 1. The page prints the rule, the numbers substituted into it and the result, so the arithmetic can be checked by hand.
p(4) = 5 because 4, 3+1, 2+2, 2+1+1 and 1+1+1+1 are the same five partitions however the terms are ordered. That is the difference between a partition and a composition. Pressed with n 20, it answers: p(20) = 627
How to use Partition Function Calculator
Enter n 20, then press Run: the page evaluates the number of ways to write n as an unordered sum and prints every line of the working. Typed input is read exactly as written, and a blank field is refused with its name.
Read the first line as the answer and the lines below it as the substitution. If a value is out of range the page refuses it by field and reason instead of printing a number.
With n 20, the answer is p(20) = 627.
Order does not matter
p(4) = 5 because 4, 3+1, 2+2, 2+1+1 and 1+1+1+1 are the same five partitions however the terms are ordered. That is the difference between a partition and a composition.
Euler's recurrence uses the pentagonal numbers and alternating signs, and every term is a whole number, so the count is exact.
What to Expect
Best for
- Working out the number of ways to write n as an unordered sum without a spreadsheet
- Checking a figure someone else quoted
- Seeing the formula behind an answer
Not ideal for
- n above 400 is refused: the recurrence is quadratic and the 400th count has 31 digits.
- A quantity the page cannot compute, which it refuses instead of estimating
- Rounding an answer that has an exact form
What this tool keeps
- P(n) by Euler's pentagonal recurrence, with p(0) = 1
- Every input exactly as typed
What may need cleanup
- Nothing: the printed answer is the final output
- A unit conversion, if the inputs were entered in different units
Common errors
- n above 400 is refused: the recurrence is quadratic and the 400th count has 31 digits.
- An empty field is refused with the field's name
Example use cases
- Work out the number of ways to write n as an unordered sum for one set of inputs
- Check the result against the formula by hand
- See which input the answer is most sensitive to
Sample input
Partition Function Calculator: n 20
Sample output
p(20) = 627 — Euler's pentagonal recurrence: p(n) = Σ (−1)^(k−1) [p(n − k(3k−1)/2) + p(n − k(3k+1)/2)], with p(0) = 1.
Who this is for
- Students checking a formula
- Anyone who needs the number and the working
Frequently asked questions
What formula does this page use?
P(n) by Euler's pentagonal recurrence, with p(0) = 1. The page prints the substitution as well, so the answer can be checked against the rule.
What does Partition Function Calculator refuse?
n above 400 is refused: the recurrence is quadratic and the 400th count has 31 digits.
What does the default example give?
N 20 gives p(20) = 627. Every line below that restates the same arithmetic.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.