OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..2100
Alois P. Heinz, Animation of a(7) = 222 walks
Wikipedia, Lattice path
Wikipedia, Self-avoiding walk
MAPLE
b:= proc(x, y, t) option remember; `if`(x<0 or
abs(y)>2*x, 0, `if`(x=0, 1, b(x-1, y, 1)+
`if`(t=1, b(x-1, y+1, 0)+b(x+1, y-1, 0), 0)))
end:
a:= n-> b(n, 0$2):
seq(a(n), n=0..32);
MATHEMATICA
b[x_, y_, t_] := b[x, y, t] = If[x < 0 || Abs[y] > 2 x, 0, If[x==0, 1, b[x - 1, y, 1] + If[t==1, b[x - 1, y + 1, 0] + b[x + 1, y - 1, 0], 0]]];
a[n_] := b[n, 0, 0];
a /@ Range[0, 32] (* Jean-François Alcover, May 13 2020, after Maple *)
CROSSREFS
KEYWORD
nonn,walk
AUTHOR
Alois P. Heinz, Oct 04 2019
STATUS
approved