%I #6 Mar 01 2021 21:51:33
%S 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,
%T 1079,76,1,1,119,3045,16995,16995,3045,119,1,1,176,7420,80464,186758,
%U 80464,7420,176,1,1,249,16164,307124,1490862,1490862,307124,16164,249,1
%N Triangle 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), read by rows.
%C The sequence is row sum dual to the Eulerian numbers A008292.
%H G. C. Greubel, <a href="/A154986/b154986.txt">Rows n = 0..50 of the triangle, flattened</a>
%F 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).
%F From _G. C. Greubel_, Mar 01 2021: (Start)
%F 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.
%F T(n, k) = T(n, n-k).
%F Sum_{k=0..n} T(n, k) = n! = A000142(n). (End)
%e Triangle begins as:
%e 1;
%e 1, 1;
%e 1, 4, 1;
%e 1, 11, 11, 1;
%e 1, 24, 70, 24, 1;
%e 1, 45, 314, 314, 45, 1;
%e 1, 76, 1079, 2728, 1079, 76, 1;
%e 1, 119, 3045, 16995, 16995, 3045, 119, 1;
%e 1, 176, 7420, 80464, 186758, 80464, 7420, 176, 1;
%e 1, 249, 16164, 307124, 1490862, 1490862, 307124, 16164, 249, 1;
%e 1, 340, 32253, 991088, 9039746, 19789944, 9039746, 991088, 32253, 340, 1;
%t (* First program *)
%t 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]];
%t Table[CoefficientList[ExpandAll[p[x,n]], x], {n,0,12}]//Flatten (* modified by _G. C. Greubel_, Mar 01 2021 *)
%t (* Second program *)
%t 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]];
%t Table[T[n,k], {n,0,12}, {k,0,n}]//Flatten (* _G. C. Greubel_, Mar 01 2021 *)
%o (Sage)
%o def T(n,k):
%o if (k==0 or k==n): return 1
%o else: return T(n-1, k) + T(n-1, k-1) + n*(n-1)*T(n-2, k-1)
%o flatten([[T(n,k) for k in (0..n)] for n in (0..12)]) # _G. C. Greubel_, Mar 01 2021
%o (Magma)
%o function T(n,k)
%o if k eq 0 or k eq n then return 1;
%o else return T(n-1, k) + T(n-1, k-1) + n*(n-1)*T(n-2, k-1);
%o end if; return T;
%o end function;
%o [T(n,k): k in [0..n], n in [0..12]]; // _G. C. Greubel_, Mar 01 2021
%Y Cf. A000142, A009292.
%Y Cf. A154982, A154980, A154979.
%Y Cf. A154983, A154984, A154985.
%K nonn,tabl
%O 0,5
%A _Roger L. Bagula_, Jan 18 2009
%E Edited by _G. C. Greubel_, Mar 01 2021