OFFSET
0,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..610
Wikipedia, Lattice path
Wikipedia, Self-avoiding walk
FORMULA
a(n) is odd <=> n in { A000918 } and n >= 0.
MAPLE
b:= proc(l) option remember; `if`(l[-1]=0, 1, (r-> add(
add(add(`if`(i+j+k=1, (h-> `if`(h[1]<0, 0, b(h)))(
sort(l-[i, j, k])), 0), k=r), j=r), i=r))([$-1..1]))
end:
a:= n-> add(b(sort([0, j, n-j])), j=0..n):
seq(a(n), n=0..29);
MATHEMATICA
b[l_] := b[l] = If[Last[l] == 0, 1, Sum[If[i + j + k == 1, Function[h, If[h[[1]] < 0, 0, b[h]]][Sort[l - {i, j, k}]], 0], {i, {-1, 0, 1}}, {j, {-1, 0, 1}}, {k, {-1, 0, 1}}]];
a[n_] := Sum[b[Sort[{0, j, n - j}]], {j, 0, n }];
a /@ Range[0, 29] (* Jean-François Alcover, May 12 2020, after Maple *)
CROSSREFS
KEYWORD
nonn,walk
AUTHOR
Alois P. Heinz, Oct 11 2019
STATUS
approved