close
login
A396200
Triangle read by rows: T(n, k) = Sum_{i=0..n} binomial(2*i, i) * binomial(n - 2*i, k - i).
0
1, 3, 3, 7, 4, 7, 15, 11, 11, 15, 31, 26, 16, 26, 31, 63, 57, 42, 42, 57, 63, 127, 120, 99, 64, 99, 120, 127, 255, 247, 219, 163, 163, 219, 247, 255, 511, 502, 466, 382, 256, 382, 466, 502, 511, 1023, 1013, 968, 848, 638, 638, 848, 968, 1013, 1023
OFFSET
0,2
COMMENTS
Unfortunately, there is no uniform definition of the binomial coefficient across mathematical software packages. On one side stand Maple, Mathematica, and PARI; on the other, Python, SageMath, and Sympy. The suspicion that this discrepancy has led to undetected errors cannot be dismissed, particularly in cases where code has been translated from one camp to the other. The triangle given here can serve as an example how easily a naive approach can lead to errors. For example, using Sympy's binomial function evaluates T(n, k) to A054143(n, k).
A definition of the binomial coefficients for Python that matches the behavior of Maple, Mathematica, and PARI is proposed in the Program section below.
FORMULA
For a recurrence see the first Python function.
T(n, k) = [x^k] [t^n] (2/((-1 + 2*t)*(2*t*x - 1)) + 1/(sqrt(-4*t^2*x + 1)*(t*x + t - 1))).
From Natalia L. Skirrow, May 19 2026: (Start)
T(n, k) = 2^(n + 1) - A204621(n, k).
T(n, k) = 2^(n + 1) - binomial(n, k)*hypergeom([1/2, -k, k-n], [(1 - n)/2, -n/2], 1).
Let m = max(k, n-k), then:
T(n, k) = Sum_{i=0..m} C(n+1, i).
T(n, k) = Sum_{i=0..m} C(2*i, i)*C(n-2*i, k-i) (using the extension in the Prog section).
T(n, k) = Sum_{i=0..m} C(ceiling(n/2)-m+2*j, j)*C(floor(n/2)+m-2*j, m-j).
Letting m = min(k, n-k) instead produces A204621. (End)
EXAMPLE
Triangle starts:
[0] 1;
[1] 3, 3;
[2] 7, 4, 7;
[3] 15, 11, 11, 15;
[4] 31, 26, 16, 26, 31;
[5] 63, 57, 42, 42, 57, 63;
[6] 127, 120, 99, 64, 99, 120, 127;
[7] 255, 247, 219, 163, 163, 219, 247, 255;
[8] 511, 502, 466, 382, 256, 382, 466, 502, 511;
[9] 1023, 1013, 968, 848, 638, 638, 848, 968, 1013, 1023;
MAPLE
T := (n, k) -> local i; add(binomial(2*i, i)*binomial(n-2*i, k-i), i = 0..n):
seq(seq(T(n, k), k = 0..n), n = 0..9);
# Alternative: hypergeometric formula
T := (n, k) -> 2^(n + 1) - binomial(n, k)*hypergeom([1/2, -k, k-n], [(1 - n)/2, -n/2], 1): seq(print(seq(simplify(T(n, k)), k = 0..n)), n = 0..9);
# Alternative: g.f. of row polynomials
MAX := 9: G := 2/((1 - 2*t)*(1 - 2*t*x)) - 1/((1 - (1 + x)*t)*sqrt(1 - 4 * x *t^2)):
ser := series(G, t, MAX + 1): tcoef := n -> simplify(coeff(ser, t, n)):
row := n -> local k; [seq(coeff(tcoef(n), x, k), k = 0..n)]: seq(row(n), n = 0..MAX);
MATHEMATICA
T[n_, k_] := Sum[Binomial[2 i, i] Binomial[n - 2 i, k - i], {i, 0, n}]
Table[T[n, k], {n, 0, 9}, {k, 0, n}]
PROG
(PARI)
T(n, k) = sum(i = 0, n, binomial(2*i, i) * binomial(n - 2*i, k - i));
print_row(n) = print("n = ", n, ": ", vector(n + 1, k, T(n, k - 1)));
for(n = 0, 9, print_row(n))
(Python) # recurrence
def T(n: int, k: int) -> int:
if n == 0: return 1
if k == 0 or k == n: return 2*T(n-1, 0) + 1
if n == 2*k: return T(n-1, 0) + 1
return T(n-1, k-1) + T(n-1, k)
for n in range(10): print([n], [T(n, k) for k in range(n + 1)])
(Python)
from math import factorial as F
def binomial(n: int, k: int) -> int:
if k == 0 or k == n: return 1
if 0 <= k <= n: return F(n) // (F(k) * F(n - k))
if k <= n < 0: return F(-k - 1) // (F(n - k) * F(-1 - n)) * (-1) ** (n - k)
if n < 0 <= k: return F(-n - 1 + k) // (F(k) * F(-n - 1)) * (-1) ** k
return 0
def T(n, k): return sum(binomial(2 * i, i) * binomial(n - 2 * i, k - i) for i in range(n + 1))
for n in range(10): print([n], [T(n, k) for k in range(n + 1)])
CROSSREFS
Cf. A000225 (T(n, 0) and T(n, n)), A396199 (row sums), A396198 (bisection of alternating row sums), A027306 (middle terms), A000302 (central terms).
Sequence in context: A099282 A002937 A085870 * A336510 A332463 A324573
KEYWORD
nonn,tabl,new
AUTHOR
Peter Luschny, May 18 2026
STATUS
approved