login
A157152
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, 3, 1, 1, 7, 7, 1, 1, 15, 30, 15, 1, 1, 31, 108, 108, 31, 1, 1, 63, 359, 594, 359, 63, 1, 1, 127, 1145, 2875, 2875, 1145, 127, 1, 1, 255, 3568, 12985, 19246, 12985, 3568, 255, 1, 1, 511, 10966, 56306, 116640, 116640, 56306, 10966, 511, 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, 1) = A000225(n). - G. C. Greubel, Jan 09 2022
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 3, 1;
1, 7, 7, 1;
1, 15, 30, 15, 1;
1, 31, 108, 108, 31, 1;
1, 63, 359, 594, 359, 63, 1;
1, 127, 1145, 2875, 2875, 1145, 127, 1;
1, 255, 3568, 12985, 19246, 12985, 3568, 255, 1;
1, 511, 10966, 56306, 116640, 116640, 56306, 10966, 511, 1;
1, 1023, 33417, 238024, 665702, 918530, 665702, 238024, 33417, 1023, 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, 1], {n, 0, 10}, {k, 0, n}]//Flatten (* modified by G. C. Greubel, Jan 09 2022 *)
PROG
(Sage)
@CachedFunction
def T(n, k, m): # A157152
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..20)]) # G. C. Greubel, Jan 09 2022
CROSSREFS
Cf. A007318 (m=0), this sequence (m=1), A157153 (m=2), A157154 (m=3), A157155 (m=4), A157156 (m=5).
Sequence in context: A193871 A108470 A328300 * A136126 A046802 A184173
KEYWORD
nonn,tabl,easy
AUTHOR
Roger L. Bagula, Feb 24 2009
EXTENSIONS
Edited by G. C. Greubel, Jan 09 2022
STATUS
approved