Difference between revisions of "Stirling numbers of the second kind"
From Fōrmulæ wiki
(Creation of page) |
(→Description (from Rosetta Code)) |
||
Line 4: | Line 4: | ||
{| class="wikitable" style="width:100%;" | {| class="wikitable" style="width:100%;" | ||
− | | Stirling numbers of the second kind, or Stirling partition numbers, are the | + | | Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to [http://rosettacode.org/wiki/Bell_numbers Bell numbers], and may be derived from them. |
− | number of ways to partition a set of n objects into k non-empty subsets. They are | + | |
− | closely related to [ | + | |
Stirling numbers of the second kind obey the recurrence relation: | Stirling numbers of the second kind obey the recurrence relation: |
Latest revision as of 10:43, 20 September 2019
This page is a solution to the task Stirling numbers of the second kind in the Rosetta Code, written in Fōrmulæ.
Description (from Rosetta Code)
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them.
Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 # for n, k > 0 S2(n, n) = 1 S2(n + 1, k) = k * S2(n, k) + S2(n, k - 1)
|
Solution
Recursive
Table up to S2(12, 12):
Non recursive
A faster, non recursive version is presented:
Table up to S2(12, 12):
(The result is the same as recursive version)
Extra
Maximum value of S2(100, k) for k ≤ 100: