OFFSET
0,5
LINKS
Alois P. Heinz, Rows n = 0..100, flattened
Wikipedia, Counting lattice paths
EXAMPLE
T(2,0) = 8: 01432, 02143, 02431, 03142, 03241, 03421, 04132, 04231.
T(2,1) = 7: 12043, 12430, 13042, 13240, 13420, 14032, 14230.
T(2,2) = 5: 23041, 23140, 23410, 24031, 24130.
T(2,3) = 2: 34021, 34120.
T(2,4) = 0.
Triangle T(n,k) begins:
1;
1, 1, 0;
8, 7, 5, 2, 0;
172, 150, 121, 87, 52, 22, 0;
7296, 6440, 5464, 4411, 3337, 2306, 1380, 604, 0;
518324, 463578, 405024, 344260, 283073, 223333, 166856, 115250, 69772, 31238, 0;
MAPLE
b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
`if`(t>0, add(b(u-j, o+j-1, t-1), j=1..u), 0)+
`if`(o+u>t, add(b(u+j-1, o-j, t+1), j=1..o), 0))
end:
T:= (n, k)-> b(k, 2*n-k, 0):
seq(seq(T(n, k), k=0..2*n), n=0..8);
MATHEMATICA
b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1,
If[t > 0, Sum[b[u - j, o + j - 1, t - 1], {j, 1, u}], 0] +
If[o + u > t, Sum[b[u + j - 1, o - j, t + 1], {j, 1, o}], 0]];
T[n_, k_] := b[k, 2n - k, 0];
Table[Table[T[n, k], {k, 0, 2n}], {n, 0, 8}] // Flatten (* Jean-François Alcover, Mar 27 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Alois P. Heinz, Jul 11 2018
STATUS
approved