login
A157156
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 = 5, read by rows.
23
1, 1, 1, 1, 7, 1, 1, 43, 43, 1, 1, 259, 806, 259, 1, 1, 1555, 11720, 11720, 1555, 1, 1, 9331, 151215, 338770, 151215, 9331, 1, 1, 55987, 1828221, 7892635, 7892635, 1828221, 55987, 1, 1, 335923, 21286168, 162474781, 304389070, 162474781, 21286168, 335923, 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 = 5.
T(n, n-k, m) = T(n, k, m).
T(n, 1, 5) = A003464(n). - G. C. Greubel, Jan 10 2022
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 7, 1;
1, 43, 43, 1;
1, 259, 806, 259, 1;
1, 1555, 11720, 11720, 1555, 1;
1, 9331, 151215, 338770, 151215, 9331, 1;
1, 55987, 1828221, 7892635, 7892635, 1828221, 55987, 1;
1, 335923, 21286168, 162474781, 304389070, 162474781, 21286168, 335923, 1;
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, 5], {n, 0, 10}, {k, 0, n}]//Flatten (* modified by G. C. Greubel, Jan 10 2022 *)
PROG
(Sage)
@CachedFunction
def T(n, k, m): # A157156
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, 5) for k in (0..n)] for n in (0..20)]) # G. C. Greubel, Jan 10 2022
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula, Feb 24 2009
EXTENSIONS
Edited by G. C. Greubel, Jan 10 2022
STATUS
approved