login
A157150
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 = 4, read by rows.
23
1, 1, 1, 1, 14, 1, 1, 87, 87, 1, 1, 460, 1790, 460, 1, 1, 2333, 24178, 24178, 2333, 1, 1, 11706, 271983, 693068, 271983, 11706, 1, 1, 58579, 2786993, 14794139, 14794139, 2786993, 58579, 1, 1, 292952, 27109300, 267169640, 547357078, 267169640, 27109300, 292952, 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 = 4.
T(n, n-k) = T(n, k).
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 14, 1;
1, 87, 87, 1;
1, 460, 1790, 460, 1;
1, 2333, 24178, 24178, 2333, 1;
1, 11706, 271983, 693068, 271983, 11706, 1;
1, 58579, 2786993, 14794139, 14794139, 2786993, 58579, 1;
1, 292952, 27109300, 267169640, 547357078, 267169640, 27109300, 292952, 1;
MAPLE
A157150:= proc(n, k);
if k<0 or n<k then 0;
elif k=0 or k=n then 1;
else (4*n-4*k+1)*procname(n-1, k-1) + (4*k+1)*procname(n-1, k) + 4*k*(n-k)*procname(n-2, k-1);
end if; end proc;
seq(seq(A157150(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, 4], {n, 0, 10}, {k, 0, n}]//Flatten (* modified by G. C. Greubel, Jan 09 2022 *)
PROG
(Sage)
@CachedFunction
def T(n, k, m): # A157150
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, 4) for k in (0..n)] for n in (0..20)]) # G. C. Greubel, Jan 09 2022
CROSSREFS
Cf. A007318 (m=0), A157147 (m=1), A157148 (m=2), A157149 (m=3), this sequence (m=4), A157151 (m=5).
Sequence in context: A157633 A157278 A144441 * A142461 A174720 A060628
KEYWORD
nonn,tabl,easy
AUTHOR
Roger L. Bagula, Feb 24 2009
EXTENSIONS
Edited by G. C. Greubel, Jan 09 2022
STATUS
approved