OFFSET
0,5
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 triangle T can be computed by the following procedure:
A = [n], P = [1], R = [1];
Repeat n times: R = [R, A], P = PS([A, P]), A = [P[end]];
Return R.
EXAMPLE
Triangle starts:
[0] 1;
[1] 1, 1;
[2] 1, 2, 3;
[3] 1, 3, 4, 11;
[4] 1, 4, 5, 14, 42;
[5] 1, 5, 6, 17, 51, 176;
[6] 1, 6, 7, 20, 60, 207, 808;
[7] 1, 7, 8, 23, 69, 238, 929, 4015;
[8] 1, 8, 9, 26, 78, 269, 1050, 4538, 21423;
[9] 1, 9, 10, 29, 87, 300, 1171, 5061, 23892, 122035;
MAPLE
Bell := n -> combinat:-bell(n):
Gould := proc(n) option remember; ifelse(n = 0, 1,
add(binomial(n, k-1)*Gould(n-k), k = 1..n)) end:
T := (n, k) -> (n-1)*Gould(k-1) + Bell(k):
for n from 0 to 9 do seq(T(n, k), k = 0..n) od;
# Alternative:
alias(PS = ListTools:-PartialSums):
A352686Row := proc(n) local a, k, P, R; a := n; P := [1]; R := [1];
for k from 1 to n do R := [op(R), a]; P := PS([a, op(P)]); a := P[-1] od; R end:
seq(print(A352686Row(n)), n = 0..9);
MATHEMATICA
gould[n_] := gould[n] = If[n == 0, 1, Sum[Binomial[n, k+1]*gould[k], {k, 0, n-1}]];
T[n_, k_] := (n-1) gould[k-1] + BellB[k];
Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Nov 08 2023, after first Maple program *)
PROG
(Julia)
function A352686Row(n)
a = BigInt(n == 0 ? 1 : n)
P = BigInt[1]; T = BigInt[1]
for k in 1:n
T = push!(T, a)
P = cumsum(pushfirst!(P, a))
a = P[end]
end
T end
for n in 0:9 println(A352686Row(n)) end
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Mar 31 2022
STATUS
approved