Skip to main content

stirling_second

Function stirling_second 

Source
pub fn stirling_second(n: u64, k: u64) -> u128
Expand description

Stirling numbers of the second kind: S(n, k).

Counts ways to partition n elements into k non-empty subsets. Time complexity: O(n*k). Results grow fast — may overflow u128 for n > 34.

§Examples

use mathverse_core::integer::stirling_second;

assert_eq!(stirling_second(4, 2), 7);