login
Triangle T(n, k, m) = (m*(n-k) + 1)*T(n-1, k-1, m) + (m*k + 1)*T(n-1, k, m) - m*k*(n-k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1 and m = 3, read by rows.
23

%I #10 Jan 10 2022 13:28:22

%S 1,1,1,1,5,1,1,21,21,1,1,85,234,85,1,1,341,2110,2110,341,1,1,1365,

%T 17163,35882,17163,1365,1,1,5461,131751,505979,505979,131751,5461,1,1,

%U 21845,976876,6395471,11433118,6395471,976876,21845,1,1,87381,7089360,75400800,220599330,220599330,75400800,7089360,87381,1

%N Triangle T(n, k, m) = (m*(n-k) + 1)*T(n-1, k-1, m) + (m*k + 1)*T(n-1, k, m) - m*k*(n-k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1 and m = 3, read by rows.

%H G. C. Greubel, <a href="/A157154/b157154.txt">Rows n = 0..50 of the triangle, flattened</a>

%F T(n, k, m) = (m*(n-k) + 1)*T(n-1, k-1, m) + (m*k + 1)*T(n-1, k, m) - m*k*(n-k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1 and m = 1.

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

%F T(n, 1, 3) = A002450(n). - _G. C. Greubel_, Jan 10 2022

%e Triangle begins as:

%e 1;

%e 1, 1;

%e 1, 5, 1;

%e 1, 21, 21, 1;

%e 1, 85, 234, 85, 1;

%e 1, 341, 2110, 2110, 341, 1;

%e 1, 1365, 17163, 35882, 17163, 1365, 1;

%e 1, 5461, 131751, 505979, 505979, 131751, 5461, 1;

%e 1, 21845, 976876, 6395471, 11433118, 6395471, 976876, 21845, 1;

%e 1, 87381, 7089360, 75400800, 220599330, 220599330, 75400800, 7089360, 87381, 1;

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

%t Table[T[n,k,3], {n,0,10}, {k,0,n}]//Flatten (* modified by _G. C. Greubel_, Jan 10 2022 *)

%o (Sage)

%o @CachedFunction

%o def T(n,k,m): # A157154

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

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

%o flatten([[T(n,k,3) for k in (0..n)] for n in (0..20)]) # _G. C. Greubel_, Jan 10 2022

%Y Cf. A007318 (m=0), A157152 (m=1), A157153 (m=2), this sequence (m=3), A157155 (m=4), A157156 (m=5).

%Y Cf. A157147, A157148, A157149, A157150, A157151, A157207, A157208, A157209, A157210, A157211, A157212, A157268, A157272, A157273, A157274, A157275.

%Y Cf. A002450.

%K nonn,tabl,easy

%O 0,5

%A _Roger L. Bagula_, Feb 24 2009

%E Edited by _G. C. Greubel_, Jan 10 2022