Skip to main content

stirling_first

Function stirling_first 

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

Unsigned Stirling numbers of the first kind: s(n, k).

Counts permutations of n elements with k disjoint cycles. Time complexity: O(n*k). Results grow fast — may overflow u128 for n > 34.

§Examples

use mathverse_core::integer::stirling_first;

assert_eq!(stirling_first(4, 2), 11);