OFFSET
0,5
COMMENTS
The sequence is row sum dual to the Eulerian numbers A008292.
LINKS
G. C. Greubel, Rows n = 0..50 of the triangle, flattened
FORMULA
T(n, k) = coefficients of p(x, n) where p(x,n) = (x+1)*p(x, n-1) + n*(n-1)*x*p(x, n-2).
From G. C. Greubel, Mar 01 2021: (Start)
T(n, k) = T(n-1, k) + T(n-1, k-1) + n*(n-1)*T(n-2, k-1) with T(n, 0) = T(n, n) = 1.
T(n, k) = T(n, n-k).
Sum_{k=0..n} T(n, k) = n! = A000142(n). (End)
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 4, 1;
1, 11, 11, 1;
1, 24, 70, 24, 1;
1, 45, 314, 314, 45, 1;
1, 76, 1079, 2728, 1079, 76, 1;
1, 119, 3045, 16995, 16995, 3045, 119, 1;
1, 176, 7420, 80464, 186758, 80464, 7420, 176, 1;
1, 249, 16164, 307124, 1490862, 1490862, 307124, 16164, 249, 1;
1, 340, 32253, 991088, 9039746, 19789944, 9039746, 991088, 32253, 340, 1;
MATHEMATICA
(* First program *)
p[x_, n_]:= p[x, n, m] = If[n<2, n*x+1, (x+1)*p[x, n-1] + n*(n-1)*x*p[x, n-2]];
Table[CoefficientList[ExpandAll[p[x, n]], x], {n, 0, 12}]//Flatten (* modified by G. C. Greubel, Mar 01 2021 *)
(* Second program *)
T[n_, k_]:= T[n, k]= If[k==0 || k==n, 1, T[n-1, k] +T[n-1, k-1] +n*(n-1)*T[n-2, k-1]];
Table[T[n, k], {n, 0, 12}, {k, 0, n}]//Flatten (* G. C. Greubel, Mar 01 2021 *)
PROG
(Sage)
def T(n, k):
if (k==0 or k==n): return 1
else: return T(n-1, k) + T(n-1, k-1) + n*(n-1)*T(n-2, k-1)
flatten([[T(n, k) for k in (0..n)] for n in (0..12)]) # G. C. Greubel, Mar 01 2021
(Magma)
function T(n, k)
if k eq 0 or k eq n then return 1;
else return T(n-1, k) + T(n-1, k-1) + n*(n-1)*T(n-2, k-1);
end if; return T;
end function;
[T(n, k): k in [0..n], n in [0..12]]; // G. C. Greubel, Mar 01 2021
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula, Jan 18 2009
EXTENSIONS
Edited by G. C. Greubel, Mar 01 2021
STATUS
approved