login
Triangle T(n,k) by rows: T(n, k) = (n-k+1)*T(n-1, k-1) + k*T(n-1, k) + T(n-2, k-1) with T(n, 1) = T(n, n) = 1.
9

%I #9 Mar 03 2022 17:06:02

%S 1,1,1,1,5,1,1,14,14,1,1,33,89,33,1,1,72,413,413,72,1,1,151,1632,3393,

%T 1632,151,1,1,310,5874,22145,22145,5874,310,1,1,629,19943,125456,

%U 224843,125456,19943,629,1,1,1268,65171,647299,1899096,1899096,647299,65171,1268,1

%N Triangle T(n,k) by rows: T(n, k) = (n-k+1)*T(n-1, k-1) + k*T(n-1, k) + T(n-2, k-1) with T(n, 1) = T(n, n) = 1.

%H G. C. Greubel, <a href="/A144438/b144438.txt">Rows n = 1..50 of the triangle, flattened</a>

%F T(n,k) = (n-k+1)*T(n-1, k-1) + k*T(n-1, k) + T(n-2, k-1), T(n, 1) = T(n, n) = 1.

%F Sum_{k=1..n} T(n, k) = A001053(n+1).

%F From _G. C. Greubel_, Mar 03 2022: (Start)

%F T(n, n-k) = T(n, k).

%F T(n, 3) = (1/2)*(n^2 +3*n +1 + 73*3^(n-3) - 5*2^(n-2)*(2*n+3)). (End)

%e Triangle begins as:

%e 1;

%e 1, 1;

%e 1, 5, 1;

%e 1, 14, 14, 1;

%e 1, 33, 89, 33, 1;

%e 1, 72, 413, 413, 72, 1;

%e 1, 151, 1632, 3393, 1632, 151, 1;

%e 1, 310, 5874, 22145, 22145, 5874, 310, 1;

%e 1, 629, 19943, 125456, 224843, 125456, 19943, 629, 1;

%e 1, 1268, 65171, 647299, 1899096, 1899096, 647299, 65171, 1268, 1;

%t T[n_, k_, m_, j_]:= T[n,k,m,j]= If[k==1 || k==n, 1, (m*(n-k)+1)*T[n-1,k-1,m,j] + (m*(k-1)+1)*T[n-1,k,m,j] + j*T[n-2,k-1,m,j]];

%t Table[T[n,k,1,1], {n,15}, {k,n}]//Flatten (* modified by _G. C. Greubel_, Mar 03 2022 *)

%o (Sage)

%o def T(n,k,m,j):

%o if (k==1 or k==n): return 1

%o else: return (m*(n-k)+1)*T(n-1,k-1,m,j) + (m*(k-1)+1)*T(n-1,k,m,j) + j*T(n-2,k-1,m,j)

%o def A144438(n,k): return T(n,k,1,1)

%o flatten([[A144438(n,k) for k in (1..n)] for n in (1..15)]) # _G. C. Greubel_, Mar 03 2022

%Y Cf. A001053 (row sums), A094002 (column k=2).

%Y Cf. A144431, A144432, A144435, A144436.

%K nonn,tabl

%O 1,5

%A _Roger L. Bagula_ and _Gary W. Adamson_, Oct 05 2008