login
A157211
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) = k if k <= floor(n/2) otherwise n-k, and m = 2, read by rows.
23
1, 1, 1, 1, 4, 1, 1, 15, 15, 1, 1, 50, 134, 50, 1, 1, 157, 960, 960, 157, 1, 1, 480, 6013, 12636, 6013, 480, 1, 1, 1451, 34717, 136809, 136809, 34717, 1451, 1, 1, 4366, 190528, 1303472, 2361474, 1303472, 190528, 4366, 1, 1, 13113, 1012326, 11392866, 34496986, 34496986, 11392866, 1012326, 13113, 1
OFFSET
0,5
FORMULA
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) = k if k <= floor(n/2) otherwise n-k, and m = 2.
T(n, n-k, m) = T(n, k, m).
T(n, 1, 2) = A132308(n-1). - G. C. Greubel, Jan 10 2022
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 4, 1;
1, 15, 15, 1;
1, 50, 134, 50, 1;
1, 157, 960, 960, 157, 1;
1, 480, 6013, 12636, 6013, 480, 1;
1, 1451, 34717, 136809, 136809, 34717, 1451, 1;
1, 4366, 190528, 1303472, 2361474, 1303472, 190528, 4366, 1;
1, 13113, 1012326, 11392866, 34496986, 34496986, 11392866, 1012326, 13113, 1;
MATHEMATICA
f[n_, k_]:= If[k<=Floor[n/2], k, n-k];
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]];
Table[T[n, k, 2], {n, 0, 12}, {k, 0, n}]//Flatten (* modified by G. C. Greubel, Jan 10 2022 *)
PROG
(Sage)
def f(n, k): return k if (k <= n//2) else n-k
@CachedFunction
def T(n, k, m): # A157211
if (k==0 or k==n): return 1
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)
flatten([[T(n, k, 2) for k in (0..n)] for n in (0..12)]) # G. C. Greubel, Jan 10 2022
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula, Feb 25 2009
EXTENSIONS
Edited by G. C. Greubel, Jan 10 2022
STATUS
approved