Tool to generate and explore integer partitions. Discover in detail the decomposition of any number N into a set of smaller numbers, whose sum is equal to N.
Number Partitions - dCode
Tag(s) : Arithmetics
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
In mathematics, a partition of a natural number $ N $ is a writing of $ N $ as a sum of non-zero natural numbers (less than or equal to $ N $).
Example: The number $ 5 $ can be decomposed into $ 7 $ distinct partitions, the additions are: $ 5, 4+1, 3+2, 3+1+1, 2+2+1, 2+1+1+1, 1+1+1+1+1 $
By convention, terms are often written in descending order.
The partition counting function $ p(N) $ counts the number of partitions of an integer $ N $.
Permutations of partitions are not counted: $ 4+1 $ and $ 1+4 $ represent the same partition
Example: The number $ 10 $ has $ 42 $ partition decompositions, $ p(10) = 42 $, and $ p(100) = 190569292 $
In 1918, G.H. Hardy and Srinivasa Ramanujan established an asymptotic formula describing the rapid growth of the partition function for large integers $ N $:
$$ p(n) \sim \frac{1}{4N \sqrt{3}} ~ e^{\pi \sqrt{\frac{2N}{3}}} $$
This formula shows that the number of partitions grows almost exponentially and allows us to estimate $ p(N) $ when the exact calculation becomes difficult.
The problem of giving change can be formulated as a partition problem with constraints: calculating the partitions of a given sum using only a fixed set of coins or bills.
Example: There are 49 ways to make $100 with $5, $10, $20 or $50 notes
Distinct partitions of an integer are partitions where the integers in the sum are all distinct from each other.
Example: 5 = 1+4 = 2+3
Non-distinct partitions include repeated numbers.
Example: 5 = 1+1+1+2 = 1+2+2
Ferrers diagrams are graphical representations of the partitions of a number using dots or boxes in rows.
Each row represents a number in the partition sum. Ferrers diagrams are a visual way to study the partitions of a number and understand their structure.
Example: The partition $ 5 = 3 + 2 $ can be represented
â—Źâ—Źâ—Ź
â—Źâ—Ź
The Ramanujan congruences, discovered by the mathematician Srinivasa Ramanujan, are particularly remarkable congruences that concern the partition function $ p(N) $.
$$ \begin{align} p(5k+4) & \equiv 0 \pmod{5} \\ p(7k+5) & \equiv 0 \pmod{7} \\ p(11k+6) & \equiv 0 \pmod{11} \end{align} $$
— Partitions into even parts: All the terms of the partition are even.
— Partitions into odd parts: All the terms of the partition are odd.
Example: For $ n = 4 $, the partitions into even parts are $ 4, ; 2+2 $, while there is no partition into odd parts.
This is a partition where all terms are identical.
Example: For $ n = 6 $, the only partition in equal parts is $ 2+2+2 $
These partitions are predictable by knowing the list of divisors of the number.
dCode retains ownership of the "Number Partitions" source code. Any algorithm for the "Number Partitions" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Number Partitions" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Number Partitions" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Number Partitions" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Number Partitions on dCode.fr [online website], retrieved on 2025-12-20,