Counting, Permutations & Combinations

Set Partition & Stirling Number Calculator

Count partitions of n labeled objects into exactly k non-empty unlabeled groups.

Counting & Combinatorics

Partition labeled objects into non-empty unlabeled groups

Stirling number S(n,k)

Exact set partitions

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 the number of labeled objects n.
  2. Enter the exact number of non-empty unlabeled groups k.
  3. Read the Stirling number of the second kind S(n,k).

Calculation method

Build the Stirling recurrence

The newest object either joins one of k existing groups or forms a new group: S(n,k)=kS(n−1,k)+S(n−1,k−1).

Worked example

Partition four objects into two groups

There are seven partitions into exactly two non-empty unlabeled groups.

S(4,2) = 2S(3,2)+S(3,1) = 7

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.

Maximum n

n is limited to 500 for the exact recurrence table.