OFFSET
0,8
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..2764
Alois P. Heinz, Animation of a(16)=237 paths
Wikipedia, Counting lattice paths
EXAMPLE
a(4) = 1: /\
/\/ \/\
. /\
a(7) = 2: /\ /\ /\/ \/\
/\/ \/\/ \/\ /\/ \/\ .
MAPLE
b:= proc(x, y, h, t) option remember; `if`(y<0 or y>x, 0,
`if`(x=0, `if`(h>1, 0, 1), `if`(t=1 and abs(y-h)<>1, 0,
b(x-1, y-1, `if`(t=1, y, h), 0))+b(x-1, y+1, h, 1)))
end:
a:= n-> b(2*n, 0$3):
seq(a(n), n=0..50);
# second Maple program:
b:= proc(x, y) option remember; (t->
`if`(x=t, 1, `if`(x<t, 0, b(x-1-2*y, y+1)+add(add(
b(x-1-2*i, y+j), j=[-1, 1]), i=1..y-1))))(3*y-2)
end:
a:= n-> `if`(n=0, 1, b(2*n-1, 1)):
seq(a(n), n=0..50);
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 05 2024
STATUS
approved