Quick guide
How to use this calculator
- Enter a positive integer n.
- Optionally specify an exact number of positive parts.
- Read the number of ordered compositions.
Calculation method
Choose separators between unit positions
There are 2^(n−1) compositions of n into any positive number of parts. Exactly k parts gives C(n−1,k−1).
Worked example
Compose four into two parts
The ordered compositions are 1+3, 2+2, and 3+1.
C(3,1) = 3
Supported inputs
Precision and limits
Discrete domain
Inputs are whole counts. Negative, fractional, grouped, and scientific-notation inputs are rejected.
Exact integers
Results use arbitrary-precision integers and are never rounded. Inputs and output size are bounded to keep the page responsive.
