Counting & Number Theory

Set Partitions, Stirling & Bell Number Calculator

Count ways to partition distinct objects into nonempty unlabelled groups.

How the calculation works

Stirling recurrence: S(n,k)=k S(n−1,k)+S(n−1,k−1), from placing the new object in an existing group or in a new singleton. Start with S(0,0)=1. Bell(n) is the sum of S(n,k) over k.

Worked example

Example inputs — Distinct objects n: 5; Exactly k nonempty unlabelled groups: 3. Expected results — Partitions into exactly k groups, S(n,k): 25; Partitions into any group count, Bell(n): 52.

Assumptions and limits

Exact integer arithmetic is used for counts and integer results. Computation limits keep this browser tool responsive. Specify whether objects/groups are distinguishable and whether order matters; different conventions count different outcomes. Objects are distinct, group names and group order are ignored, and every object appears in exactly one group. This differs from identical-item bins and integer partitions. S(0,0)=Bell(0)=1; zero groups with positive objects gives zero.

Reference and further reading

Read the underlying subject reference. Calculith is an independent implementation; the reference does not endorse or certify this tool.

Related calculators

Browse all 1000 calculators →

Example values are editable. Results are estimates where assumptions apply. Calculations run in your browser. Updated 2026-11-16.