Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #18 Feb 22 2019 21:17:57
%S 1,1,2,1,5,4,1,9,23,8,1,14,82,93,16,1,20,234,607,343,32,1,27,588,2991,
%T 3800,1189,64,1,35,1365,12501,30155,21145,3951,128,1,44,3010,47058,
%U 195626,256500,108286,12749,256,1,54,6416,165254,1111910,2456256,1932216,522387,40295,512
%N Triangle T(n,k) read by rows: T(n,k)= (k-1)*T(n-1,k) + (n-k+2)*T(n-1, k-1), with T(n,1)=1, for 1 <= k <= n, n >= 1.
%C Row sums are apparently in A002627.
%C The Mathematica code gives ten sequences of which the first few are in the OEIS (see Crossrefs section). - _G. C. Greubel_, Feb 22 2019
%H G. C. Greubel, <a href="/A157011/b157011.txt">Rows n = 1..100 of triangle, flattened</a>
%e The triangle starts in row n=1 as:
%e 1;
%e 1, 2;
%e 1, 5, 4;
%e 1, 9, 23, 8;
%e 1, 14, 82, 93, 16;
%e 1, 20, 234, 607, 343, 32;
%e 1, 27, 588, 2991, 3800, 1189, 64;
%e 1, 35, 1365, 12501, 30155, 21145, 3951, 128;
%e 1, 44, 3010, 47058, 195626, 256500, 108286, 12749, 256;
%e 1, 54, 6416, 165254, 1111910, 2456256, 1932216, 522387, 40295, 512;
%p A157011 := proc(n,k) if k <0 or k >= n then 0; elif k =0 then 1; else k*procname(n-1,k)+(n-k+1)*procname(n-1,k-1) ; end if; end proc: # _R. J. Mathar_, Jun 18 2011
%t e[n_, 0, m_]:= 1;
%t e[n_, k_, m_]:= 0 /; k >= n;
%t e[n_, k_, m_]:= (k+m)*e[n-1, k, m] + (n-k+1-m)*e[n-1, k-1, m];
%t Table[Flatten[Table[Table[e[n, k, m], {k,0,n-1}], {n,1,10}]], {m,0,10}]
%t T[n_, 1]:= 1; T[n_, n_]:= 2^(n-1); T[n_, k_]:= T[n, k] = (k-1)*T[n-1, k] + (n-k+2)*T[n-1, k-1]; Table[T[n, k], {n, 1, 10}, {k, 1, n}]//Flatten (* G. C. Greubel, Feb 22 2019 *)
%o (PARI) {T(n, k) = if(k==1, 1, if(k==n, 2^(n-1), (k-1)*T(n-1, k) + (n-k+2)* T(n-1, k-1)))};
%o for(n=1, 10, for(k=1, n, print1(T(n, k), ", "))) \\ _G. C. Greubel_, Feb 22 2019
%o (Sage)
%o def T(n, k):
%o if (k==1):
%o return 1
%o elif (k==n):
%o return 2^(n-1)
%o else: return (k-1)*T(n-1, k) + (n-k+2)* T(n-1, k-1)
%o [[T(n, k) for k in (1..n)] for n in (1..10)] # _G. C. Greubel_, Feb 22 2019
%Y Cf. A000096 (column k=1), A002627, A008517.
%Y Cf. This sequence (m=0), A008292 (m=1), A157012 (m=2), A157013 (m=3).
%K nonn,tabl,easy
%O 1,3
%A _Roger L. Bagula_, Feb 21 2009