Stirling Number Calculator

S(n,k) partitions & cycles

CalculatorsFreeNo Signup
4.9(330 reviews)
All Tools

Loading tool...

About Stirling Number Calculator

A Stirling number calculator for both kinds. Second kind S(n,k): ways to partition n elements into k non-empty subsets. First kind s(n,k): related to permutation cycles. Shows recurrences and triangle display. All calculations are client-side.

Stirling Number Calculator Features

  • S₂(n,k)
  • s₁(n,k)
  • Triangle
  • Recurrence
  • Bell numbers
Stirling numbers: S₂(n,k) = ways to partition {1,...,n} into k non-empty subsets. Recurrence: S₂(n,k) = k·S₂(n−1,k) + S₂(n−1,k−1). Bell number: Bₙ = Σₖ S₂(n,k). First kind |s₁(n,k)|: permutations of n with exactly k cycles.

How to Use

Enter parameters:

  • n: Total elements
  • k: Number of parts/cycles
  • Output: S(n,k)

Second Kind

S₂(n,k) = (1/k!)Σⱼ(−1)ʲC(k,j)(k−j)ⁿ. Base: S₂(n,1)=1, S₂(n,n)=1. S₂(n,2)=2ⁿ⁻¹−1. xⁿ = Σₖ S₂(n,k)·x(x−1)···(x−k+1).

First Kind

|s₁(n,k)| counts permutations with k cycles. s₁(n,1) = (n−1)!. x(x+1)···(x+n−1) = Σₖ |s₁(n,k)|xᵏ (rising factorial).

Step-by-Step Instructions

  1. 1Enter n and k.
  2. 2Get S₂(n,k).
  3. 3Get |s₁(n,k)|.
  4. 4View triangle.
  5. 5Compute Bell number.

Stirling Number Calculator — Frequently Asked Questions

What is the difference between the two kinds?+

Second kind S₂(n,k): partition n labeled objects into k identical non-empty groups. First kind |s₁(n,k)|: arrange n objects in k cycles. They're connected by inverse polynomial relations: falling factorial = Σ s₁(n,k)xᵏ and xⁿ = Σ S₂(n,k)·falling(x,k).

What are Bell numbers?+

Bₙ = Σₖ S₂(n,k) = total number of partitions of {1,...,n}. B₀=1, B₁=1, B₂=2, B₃=5, B₄=15, B₅=52. The Bell triangle gives all values. Dobinski's formula: Bₙ = (1/e)Σₖ kⁿ/k!.

How is S₂(n,k) related to surjections?+

Number of surjections (onto functions) from n-set to k-set = k!·S₂(n,k). By inclusion-exclusion: k!·S₂(n,k) = Σⱼ(−1)ʲC(k,j)(k−j)ⁿ. Dividing by k! removes the labeling of the k subsets.

Share this tool: