login
A157151
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, 17, 1, 1, 123, 123, 1, 1, 769, 3046, 769, 1, 1, 4655, 49500, 49500, 4655, 1, 1, 27981, 673015, 1721070, 673015, 27981, 1, 1, 167947, 8363421, 44640435, 44640435, 8363421, 167947, 1, 1, 1007753, 98882848, 982172031, 2012583870, 982172031, 98882848, 1007753, 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, 5) = T(n, k, 5).
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 17, 1;
1, 123, 123, 1;
1, 769, 3046, 769, 1;
1, 4655, 49500, 49500, 4655, 1;
1, 27981, 673015, 1721070, 673015, 27981, 1;
1, 167947, 8363421, 44640435, 44640435, 8363421, 167947, 1;
1, 1007753, 98882848, 982172031, 2012583870, 982172031, 98882848, 1007753, 1;
MAPLE
A157151:= proc(n, k)
if k<0 or n<k then 0;
elif k=0 or k=n then 1;
else (5*n-5*k+1)*procname(n-1, k-1) + (5*k+1)*procname(n-1, k) + 5*k*(n-k)*procname(n-2, k-1);
end if; end proc;
seq(seq(A157151(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, 5], {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, 5) for k in (0..n)] for n in (0..10)]) # G. C. Greubel, Jan 09 2022
CROSSREFS
Cf. A007318 (m=0), A157147 (m=1), A157148 (m=2), A157149 (m=3), A157150 (m=4), this sequence (m=5).
Sequence in context: A157274 A218115 A144442 * A176794 A176244 A022180
KEYWORD
nonn,tabl,easy
AUTHOR
Roger L. Bagula, Feb 24 2009
EXTENSIONS
Edited by G. C. Greubel, Jan 09 2022
STATUS
approved