OFFSET
0,9
LINKS
Alois P. Heinz, Rows n = 0..140, flattened
EXAMPLE
: T(4,2) = 5: /\ /\ /\/\ /\ /\ /\/\/\
: /\/\/ \ /\/ \/\ /\/ \ / \/ \ / \
:
Triangle T(n,k) begins:
1;
0, 1;
0, 1, 1;
0, 1, 2, 1;
0, 1, 5, 3, 1;
0, 1, 9, 11, 4, 1;
0, 1, 19, 31, 19, 5, 1;
0, 1, 35, 91, 69, 29, 6, 1;
0, 1, 71, 250, 252, 127, 41, 7, 1;
0, 1, 135, 690, 855, 540, 209, 55, 8, 1;
MAPLE
b:= proc(x, y, k) option remember; `if`(x=0, z^k, `if`(y<x-1,
b(x-1, y+1, max(y+1, k)), 0)+`if`(y>0, b(x-1, y-1, k), 0))
end:
g:= proc(x, y, k) option remember; `if`(x=0, z^k, `if`(y>0,
g(x-2, y-1, k), 0)+ g(x-2, y+1, max(y+1, k)))
end:
T:= n-> (p-> seq(coeff(p, z, i)/2, i=0..n))(b(2*n, 0$2)+g(2*n, 0$2)):
seq(T(n), n=0..14);
MATHEMATICA
b[x_, y_, k_] := b[x, y, k] = If[x == 0, z^k, If[y < x - 1, b[x - 1, y + 1, Max[y + 1, k]], 0] + If[y > 0, b[x - 1, y - 1, k], 0]];
g[x_, y_, k_] := g[x, y, k] = If[x == 0, z^k, If[y > 0, g[x - 2, y - 1, k], 0] + g[x - 2, y + 1, Max[y + 1, k]]];
T[n_] := Function[p, Table[Coefficient[p, z, i]/2, {i, 0, n}]][b[2*n, 0, 0] + g[2*n, 0, 0]];
Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Jun 03 2018, from Maple *)
PROG
(Python)
from sympy.core.cache import cacheit
from sympy import Poly, Symbol, flatten
z=Symbol('z')
@cacheit
def b(x, y, k): return z**k if x==0 else (b(x - 1, y + 1, max(y + 1, k)) if y<x - 1 else 0) + (b(x - 1, y - 1, k) if y>0 else 0)
@cacheit
def g(x, y, k): return z**k if x==0 else (g(x - 2, y - 1, k) if y>0 else 0) + g(x - 2, y + 1, max(y + 1, k))
def T(n): return 1 if n==0 else [i//2 for i in Poly(b(2*n, 0, 0) + g(2*n, 0, 0)).all_coeffs()[::-1]]
print(flatten(map(T, range(15)))) # Indranil Ghosh, Sep 06 2017
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Alois P. Heinz, Sep 05 2017
STATUS
approved