← Mathématiques et statistiques

Order-sensitive sums

Integer composition calculator (order matters)

Explore integer compositions where order matters. Switch between exact counts, k-part compositions, bounded parts, and nonnegative k-part variants.

All calculations run locally in your browser.

Autres langues ja | en | zh-CN | es | pt-BR | id | fr | hi-IN | ar

How to use (3 steps)

  1. Choose Composition or Partition, then pick the constraint you need.
  2. Enter n (and k/a/b when required), then select count, table, enumeration, or sample.
  3. Export CSV/TSV or copy a shareable URL for reuse.

Inputs

--

Key formulas and notes

FAQ

What is the difference between partitions and compositions?

Partitions ignore order while compositions treat different orders as distinct.

Why is composition count 2^(n-1)?

Each of the n-1 gaps is a divider or not, giving 2^(n-1) combinations.

How do I count compositions with exactly k parts?

Select exactly k parts to compute C(n-1, k-1).

What is the nonnegative k-part formula?

It is C(n+k-1, k-1), the stars and bars count.

Can I restrict parts to a range?

Use bounded parts to restrict each part to [a, b].

Why is enumeration limited for large n?

The number of compositions grows quickly, so enumeration is capped.

Can I compute modulo m?

Yes. Switch to modulo mode and enter the modulus.

Do these samples use a fixed seed?

Yes. The same seed reproduces the same list of samples.