RosettaCodeData/Task/Bell-numbers/Mathematica/bell-numbers-1.math

3 lines
152 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
BellTriangle[n_Integer?Positive] := NestList[Accumulate[# /. {a___, b_} :> {b, a, b}] &, {1}, n - 1];
BellNumber[n_Integer] := BellTriangle[n][[n, 1]];