Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Stirling Number of the First Kind s(n,k)
-50
signed value
n 5
k 2

What is the Stirling Number of the First Kind?

The signed Stirling numbers of the first kind, written \(s(n,k)\), are the coefficients you get when you expand the falling factorial \(x(x-1)(x-2)\cdots(x-n+1)\) into ordinary powers of \(x\). Their absolute values, \(c(n,k) = |s(n,k)|\), count the number of permutations of \(n\) elements that decompose into exactly \(k\) disjoint cycles. The two are linked by the sign rule \(s(n,k) = (-1)^{n-k} c(n,k)\). This calculator returns the signed value, matching the falling-factorial coefficient convention.

How to Use It

Enter two non-negative integers: \(n\) (the size parameter) and \(k\) (the number of cycles, equivalently the power index). Press calculate and the tool returns \(s(n,k)\). If \(k\) is greater than \(n\) the answer is 0; \(s(n,n)\) is always 1; and \(s(0,0)\) is 1 by definition.

The Formula Explained

We build a small dynamic-programming table using the recurrence $$s(n+1,k) = s(n,k-1) - n\, s(n,k)$$ starting from \(s(0,0)=1\), with \(s(n,0)=0\) for \(n>0\) and \(s(0,k)=0\) for \(k>0\). Each row is computed from the previous one, so no large lookup table is needed. The negative term in the recurrence is what produces the alternating signs.

Advertisement
Recurrence diagram showing s(n+1,k) formed from s(n,k-1) and s(n,k)
The recurrence builds each Stirling number from two values in the previous row.

Worked Example

Compute \(s(5,2)\). The unsigned cycle counts for row 5 are \(c(5,1)=24\), \(c(5,2)=50\), \(c(5,3)=35\), \(c(5,4)=10\), \(c(5,5)=1\). The sign is \((-1)^{5-2} = -1\), so $$s(5,2) = -50.$$ Check: $$x(x-1)(x-2)(x-3)(x-4) = x^5 - 10x^4 + 35x^3 - 50x^2 + 24x,$$ and the coefficient of \(x^2\) is indeed \(-50\).

Triangular table of signed Stirling numbers of the first kind with a highlighted entry
Arranged in a triangle, each entry is computed from the two cells above it.

FAQ

Why can the result be negative? Because this is the signed version; the coefficient of \(x^k\) in the falling factorial alternates sign according to \((-1)^{n-k}\).

How do I get the unsigned cycle count? Take the absolute value: \(c(n,k) = |s(n,k)|\).

What is the sum of unsigned values across a row? The sum of \(c(n,k)\) over all \(k\) equals \(n!\) (\(n\) factorial).

Last updated: