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*f(n,k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1, f(n, k) = 2*k if k <= floor(n/2) otherwise 2*(n-k), and m = 2, read by rows.
8

%I #6 Feb 06 2022 02:06:38

%S 1,1,1,1,10,1,1,39,39,1,1,128,470,128,1,1,397,3558,3558,397,1,1,1206,

%T 22387,55452,22387,1206,1,1,3635,128377,632343,632343,128377,3635,1,1,

%U 10924,698788,6107192,12269406,6107192,698788,10924,1,1,32793,3686880,53375112,187721254,187721254,53375112,3686880,32793,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*f(n,k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1, f(n, k) = 2*k if k <= floor(n/2) otherwise 2*(n-k), and m = 2, read by rows.

%H G. C. Greubel, <a href="/A157277/b157277.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*f(n,k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1, f(n, k) = 2*k if k <= floor(n/2) otherwise 2*(n-k), and m = 2.

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

%e Triangle begins as:

%e 1;

%e 1, 1;

%e 1, 10, 1;

%e 1, 39, 39, 1;

%e 1, 128, 470, 128, 1;

%e 1, 397, 3558, 3558, 397, 1;

%e 1, 1206, 22387, 55452, 22387, 1206, 1;

%e 1, 3635, 128377, 632343, 632343, 128377, 3635, 1;

%e 1, 10924, 698788, 6107192, 12269406, 6107192, 698788, 10924, 1;

%t f[n_,k_]:= If[k<=Floor[n/2], 2*k, 2*(n-k)];

%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*f[n,k]*T[n-2,k-1,m]];

%t Table[T[n,k,2], {n,0,12}, {k,0,n}]//Flatten (* modified by _G. C. Greubel_, Feb 05 2022 *)

%o (Sage)

%o def f(n,k): return 2*k if (k <= n//2) else 2*(n-k)

%o @CachedFunction

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

%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*f(n,k)*T(n-2,k-1,m)

%o flatten([[T(n,k,2) for k in (0..n)] for n in (0..12)]) # _G. C. Greubel_, Feb 05 2022

%Y Cf. A007318 (m=0), A157275 (m=1), this sequence (m=2), A157278 (m=3).

%Y Cf. A157147, A157148, A157149, A157150, A157151, A157152, A157153, A157154, A157155, A157156, A157207, A157208, A157209, A157210, A157211, A157212, A157268, A157272, A157273, A157274.

%K nonn,tabl

%O 0,5

%A _Roger L. Bagula_, Feb 26 2009

%E Edited by _G. C. Greubel_, Feb 05 2022