[go: up one dir, main page]

login
A157147
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 = 1, read by rows.
23
1, 1, 1, 1, 5, 1, 1, 15, 15, 1, 1, 37, 110, 37, 1, 1, 83, 568, 568, 83, 1, 1, 177, 2415, 5534, 2415, 177, 1, 1, 367, 9137, 41027, 41027, 9137, 367, 1, 1, 749, 32104, 255155, 498814, 255155, 32104, 749, 1, 1, 1515, 107442, 1409814, 4845540, 4845540, 1409814, 107442, 1515, 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*k*(n-k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1 and m = 1.
T(n, n-k) = T(n, k).
EXAMPLE
1;
1, 1;
1, 5, 1;
1, 15, 15, 1;
1, 37, 110, 37, 1;
1, 83, 568, 568, 83, 1;
1, 177, 2415, 5534, 2415, 177, 1;
1, 367, 9137, 41027, 41027, 9137, 367, 1;
1, 749, 32104, 255155, 498814, 255155, 32104, 749, 1;
1, 1515, 107442, 1409814, 4845540, 4845540, 1409814, 107442, 1515, 1;
MAPLE
A157147:= proc(n, k)
option remember;
if k < 0 or k> n then 0;
elif k = 0 or k = n then 1;
else (n-k+1)*procname(n-1, k-1) +(k+1)*procname(n-1, k) +k*(n-k)*procname(n-2, k-1);
end if;
end proc:
seq(seq(A157147(n, k), k=0..n), n=0..10); # R. J. Mathar, Feb 06 2015
MATHEMATICA
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]];
Table[T[n, k, 1], {n, 0, 10}, {k, 0, n}]//Flatten (* modified by G. C. Greubel, Jan 09 2022 *)
PROG
(Sage)
def T(n, k, m): # A157147
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*k*(n-k)*T(n-2, k-1, m)
flatten([[T(n, k, 1) for k in (0..n)] for n in (0..10)]) # G. C. Greubel, Jan 09 2022
KEYWORD
nonn,tabl,easy
AUTHOR
Roger L. Bagula, Feb 24 2009
EXTENSIONS
Edited by G. C. Greubel, Jan 09 2022
STATUS
approved