BellTriangle[n_Integer?Positive] := NestList[Accumulate[# /. {a___, b_} :> {b, a, b}] &, {1}, n - 1]; BellNumber[n_Integer] := BellTriangle[n][[n, 1]];