Resource · Guide or article
Integer Partition
Defines integer partitions, ways to write n as a sum where order does not matter, and contrasts them with compositions.
Reviewed
Open the original: Integer Partition (opens the original site in a new tab)Add to a roadmap
Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.
Source content: English
In number theory and combinatorics, a partition of a positive integer n, also called an integer partition, is a way of writing n as a sum of positive integers. Two sums that differ only in the order of their summands are considered the same partition. For example, 4 can be partitioned in five distinct ways: The order-dependent composition 1 + 3 is the same partition as 3 + 1, while the two distinct compositions 1 + 2 + 1 and 1 + 1 + 2 represent the same partition 2 + 1 + 1.
PrepKit overview
PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.
- Suited to
- The source does not state a level
- Format
- Reference
What it covers
- All five partitions of 4
- Why 1 + 3 and 3 + 1 count as one partition
- Young diagrams for partitions of 1 through 8, showing conjugates
How to use it
PrepKit study advice, not a claim made by the source.
Write a DP counting partitions of n, check it gives 5 for n = 4, and explain how loop order avoids counting 1 + 3 and 3 + 1 twice.
Scope and limitations
No counting algorithm, recurrence or complexity; those sit behind Wikipedia and YouTube links.
Access and format
Free English README on GitHub in the MIT-licensed trekhleb/javascript-algorithms repository.
Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88
Evidence behind this overview
- src/algorithms/math/integer-partition/README.md
Pages that include this
Get the PrepKit newsletter
Optional. You don't need it to use PrepKit.