OFFSET
0,8
COMMENTS
FORMULA
Given a list T let PS(T) denote the list of partial sums of T. Given two list S and T let [S, T] denote the concatenation of the lists. Further let P[end] denote the last element of the list P. Row n of the array with length k can be computed by the following procedure:
A = [n], P = [1], R = [1];
Repeat k-1 times: R = [R, A], P = PS([A, P]), A = [P[end]];
Return R.
EXAMPLE
Array starts:
n\k 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...
---------------------------------------------------------
[0] 1, 0, 1, 2, 6, 21, 82, 354, 1671, 8536, ... A032347
[1] 1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147, ... A000110
[2] 1, 2, 3, 8, 24, 83, 324, 1400, 6609, 33758, ... A038561
[3] 1, 3, 4, 11, 33, 114, 445, 1923, 9078, 46369, ... A038559
[4] 1, 4, 5, 14, 42, 145, 566, 2446, 11547, 58980, ... A352683
[5] 1, 5, 6, 17, 51, 176, 687, 2969, 14016, 71591, ...
[6] 1, 6, 7, 20, 60, 207, 808, 3492, 16485, 84202, ...
[7] 1, 7, 8, 23, 69, 238, 929, 4015, 18954, 96813, ...
[8] 1, 8, 9, 26, 78, 269, 1050, 4538, 21423, 109424, ...
[9] 1, 9, 10, 29, 87, 300, 1171, 5061, 23892, 122035, ...
MAPLE
alias(PS = ListTools:-PartialSums):
BellRow := proc(n, len) local a, k, P, T;
a := n; P := [1]; T := [1];
for k from 1 to len-1 do
T := [op(T), a]; P := PS([a, op(P)]); a := P[-1] od;
T end: seq(lprint(BellRow(n, 10)), n = 0..9);
MATHEMATICA
nmax = 10;
BellRow[n_, len_] := Module[{a, k, P, T}, a = n; P = {1}; T = {1};
For[k = 1, k <= len - 1, k++,
T = Append[T, a]; P = Accumulate[Join[{a}, P]]; a = P[[-1]]];
T];
rows = Table[BellRow[n, nmax + 1], {n, 0, nmax}];
A[n_, k_] := rows[[n + 1, k + 1]];
Table[A[n - k, k], {n, 0, nmax}, {k, 0, n}] // Flatten (* Jean-François Alcover, Apr 15 2024, after Peter Luschny *)
PROG
(Julia)
function BellRow(m, len)
a = m; P = BigInt[1]; T = BigInt[1]
for n in 1:len
T = vcat(T, a)
P = cumsum(vcat(a, P))
a = P[end]
end
T end
for n in 0:9 BellRow(n, 9) |> println end
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Mar 28 2022
STATUS
approved