Lah numbers
From Fōrmulæ wiki
This page is a solution to the task Lah numbers in the Rosetta Code, written in Fōrmulæ.
Description (from Rosetta Code)
Lah numbers, sometimes referred to as Stirling numbers of the third kind, are coefficients of polynomial expansions expressing rising factorials in terms of falling factorials.
Unsigned Lah numbers count the number of ways a set of n elements can be partitioned into k non-empty linearly ordered subsets. Lah numbers are closely related to Stirling numbers of the first & second kinds, and may be derived from them. Lah numbers obey the identities and relations: L(n, 0), L(0, k) = 0 # for n, k > 0 L(n, n) = 1 L(n, 1) = n! L(n, k) = ( n! * (n - 1)! ) / ( k! * (k - 1)! ) / (n - k)! # For unsigned Lah numbers or L(n, k) = (-1)**n * ( n! * (n - 1)! ) / ( k! * (k - 1)! ) / (n - k)! # For signed Lah numbers
|
Solution
A single solution for signed and unsigned versions is presented. Unsigned version uses 1 as factor, signed version used -1.
Table up to L(12, 12), unsigned version:
Table up to L(12, 12), signed version:
Extra
Maximum value of L(100, k) for k ≤ 100, unsigned version:
Maximum value of L(100, k) for k ≤ 100, signed version:
(The result is the same that the previous one)