Stirling Numbers of the First Kind
The (unsigned) Stirling number of the first kind c(n, k) counts the permutations of n elements with exactly k cycles. It satisfies the recurrence c(n, k) = c(n−1, k−1) + (n−1)·c(n−1, k) with c(0,0) = 1. The sum over k is n! (every permutation has some number of cycles). This tool computes c(n, k) exactly with big integers, shows the full row c(n, 1…n), the signed version s(n,k) = (−1)n−kc(n,k), and the cycle-count triangle. Runs locally in your browser.
Input
Result
Row c(n, 1 … n)
Cycle-count triangle (rows 0 … n)
c(n, k) is the number of permutations of n labelled elements with exactly k disjoint cycles — e.g. c(4, 2) = 11: eleven of the 24 permutations of 4 elements have two cycles. Recurrence c(n, k) = c(n−1, k−1) + (n−1)·c(n−1, k): element n either forms its own cycle (c(n−1, k−1)) or is inserted into one of the n−1 positions of an existing k-cycle permutation ((n−1)·c(n−1, k)). The signed Stirling number is s(n, k) = (−1)n−kc(n, k); it is the coefficient of xk in the falling factorial x(x−1)(x−2)…(x−n+1). The row sum Σₖ c(n, k) = n! holds because every permutation has some cycle count. Pairs with the Bell Numbers (Stirling 2nd kind) and Derangements tools. Everything runs locally — nothing leaves your browser.