[go: up one dir, main page]

login
A157207
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) = k if k <= floor(n/2) otherwise n-k, and m = 1, read by rows.
23
1, 1, 1, 1, 5, 1, 1, 14, 14, 1, 1, 33, 94, 33, 1, 1, 72, 442, 442, 72, 1, 1, 151, 1752, 3818, 1752, 151, 1, 1, 310, 6306, 25358, 25358, 6306, 310, 1, 1, 629, 21390, 144524, 268852, 144524, 21390, 629, 1, 1, 1268, 69822, 746744, 2312836, 2312836, 746744, 69822, 1268, 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) = k if k <= floor(n/2) otherwise n-k, and m = 1.
T(n, n-k, m) = T(n, k, m).
T(n, 1, 1) = A094002(n-1). - G. C. Greubel, Jan 10 2022
EXAMPLE
Triangle begins as:
1;
1, 1;
1, 5, 1;
1, 14, 14, 1;
1, 33, 94, 33, 1;
1, 72, 442, 442, 72, 1;
1, 151, 1752, 3818, 1752, 151, 1;
1, 310, 6306, 25358, 25358, 6306, 310, 1;
1, 629, 21390, 144524, 268852, 144524, 21390, 629, 1;
1, 1268, 69822, 746744, 2312836, 2312836, 746744, 69822, 1268, 1;
MATHEMATICA
f[n_, k_]:= If[k<=Floor[n/2], k, 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, 10}, {k, 0, n}]//Flatten (* modified by G. C. Greubel, Jan 10 2022 *)
PROG
(Sage)
def f(n, k): return k if (k <= n//2) else n-k
@CachedFunction
def T(n, k, m): # A157207
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..20)]) # G. C. Greubel, Jan 10 2022
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Roger L. Bagula, Feb 25 2009
EXTENSIONS
Edited by G. C. Greubel, Jan 10 2022
STATUS
approved