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
  1. 1EnterProvide the known values
  2. 2CalculateResults update automatically
  3. 3VerifyReview the details and units
Try an example

Exact compositions

Enter valid values to see the result.

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

Feedback

Understand the subject

What is an integer composition?

An integer composition writes a positive integer as positive parts while keeping their order. Here, 1 + 3 and 3 + 1 are different.

Use it when ordered stages, cuts, or sequences of positive parts matter.

The relationship

The counting rule

See the structure

Separator positions create ordered parts

Worked example

Check the rule with a small case

Four into exactly two positive ordered parts gives C(3,1) = 3.

Interpret with care

Choose the right counting model

Composition is not partition: reordering parts changes the result.

Use the Permutation & Combination Generator when a small case needs to be inspected rather than only counted.

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.