Counting, Permutations & Combinations

Integer Composition Calculator

Count ordered ways to express a positive integer as a sum of positive integers.

Counting & Combinatorics

Count ordered sums of positive integers

All lengths or exactly k parts

Exact compositions

Enter valid values to see the result.

Your entries are calculated in this browser and are not submitted to 365CALCS.COM.

Quick guide

How to use this calculator

  1. Enter a positive integer n.
  2. Optionally specify an exact number of positive parts.
  3. 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.