Skip to main content
Calcimator

Stirling Number Calculator

Calculate Stirling numbers of the first and second kind, plus Bell numbers for set partitions.

Inputs

Results

Stirling Number S(n,k)

25

Bell Number B(n)

52

How to Use This Calculator
  1. Enter n and k — the Stirling number S(n, k) counts a specific combinatorial structure.
  2. Select Kind: First (signed cycle decompositions) or Second (partitions into non-empty subsets).
  3. Review the Stirling Number S(n, k) for the selected kind.
  4. Check Bell Number B(n) — the sum of all Stirling numbers of the second kind for a given n.
  5. Use Stirling numbers in combinatorics, probability, and the analysis of divide-and-conquer algorithms.

How the result changes with n

nStirling Number S(n,k)Bell Number B(n)
2.515
8.753,02521,147
167,141,68610,480,142,147
2315,686,335,50144,152,005,855,084,344

What each input means

n
Size of the set (max 25 to avoid overflow)
k
Number of cycles (1st kind) or blocks/partitions (2nd kind)
Kind (1=First, 2=Second)
Stirling number kind: 1st (permutation cycles) or 2nd (set partitions)

How this is calculated

Worked example, using the default values

  1. Identify Input Parameters
    n = 5, k = 3, Kind (1=First, 2=Second) = 2 = 3 input(s) provided
  2. Calculate Stirling Number S
    Stirling Number S
    25 = 25
  3. Calculate Bell Number B
    Bell Number B
    52 = 52

Engine last updated . Checked against 7 independently-derived tests how we verify calculators.

The questions that sit next to this one — chosen by subject, including calculators filed under a different category.

More in Math & Statistics.