[go: up one dir, main page]

login
A157275
Triangle T(n, k, m) = (m*(n-k) + 1)*T(n-1, k-1, m) + (m*k + 1)*T(n-1, k, m) + m*f(n,k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1, f(n, k) = 2*k if k <= floor(n/2) otherwise 2*(n-k), and m = 1, read by rows.
23
1, 1, 1, 1, 6, 1, 1, 17, 17, 1, 1, 40, 126, 40, 1, 1, 87, 606, 606, 87, 1, 1, 182, 2413, 5604, 2413, 182, 1, 1, 373, 8679, 38117, 38117, 8679, 373, 1, 1, 756, 29376, 219020, 426002, 219020, 29376, 756, 1, 1, 1523, 95668, 1133786, 3749066, 3749066, 1133786, 95668, 1523, 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*f(n,k)*T(n-2, k-1, m) with T(n, 0, m) = T(n, n, m) = 1, f(n, k) = 2*k if k <= floor(n/2) otherwise 2*(n-k), and m = 1.
T(n, n-k, m) = T(n, k, m).
T(n, 1, 1) = A101945(n-1), for n >= 1. - G. C. Greubel, Feb 05 2022
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 6, 1;
1, 17, 17, 1;
1, 40, 126, 40, 1;
1, 87, 606, 606, 87, 1;
1, 182, 2413, 5604, 2413, 182, 1;
1, 373, 8679, 38117, 38117, 8679, 373, 1;
1, 756, 29376, 219020, 426002, 219020, 29376, 756, 1;
1, 1523, 95668, 1133786, 3749066, 3749066, 1133786, 95668, 1523, 1;
MATHEMATICA
f[n_, k_]:= If[k<=Floor[n/2], 2*k, 2*(n-k)];
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*f[n, k]*T[n-2, k-1, m]];
Table[T[n, k, 1], {n, 0, 12}, {k, 0, n}]//Flatten (* modified by G. C. Greubel, Feb 05 2022 *)
PROG
(Sage)
def f(n, k): return 2*k if (k <= n//2) else 2*(n-k)
@CachedFunction
def T(n, k, m): # A157275
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*f(n, k)*T(n-2, k-1, m)
flatten([[T(n, k, 1) for k in (0..n)] for n in (0..12)]) # G. C. Greubel, Feb 05 2022
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula, Feb 26 2009
EXTENSIONS
Edited by G. C. Greubel, Feb 05 2022
STATUS
approved