OFFSET
0,3
COMMENTS
All terms are odd.
Lattice points may have negative coordinates, and different walks may differ in length. All walks are self-avoiding.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1236
Alois P. Heinz, Animation of a(4) = 173 walks
Wikipedia, Counting lattice paths
Wikipedia, Self-avoiding walk
MAPLE
s:= proc(n) option remember;
`if`(n=0, [[]], map(x-> seq([x[], i], i=-1..1), s(n-1)))
end:
b:= proc(l) option remember; (n-> `if`(l=[0$n], 1, add((h-> `if`(
add(i^2, i=h)<add(i^2, i=l), b(sort(h)), 0))(l+x), x=s(n))))(nops(l))
end:
a:= n-> b([0, n]):
seq(a(n), n=0..30);
MATHEMATICA
b[n_, k_] := b[n, k] = If[{n, k} == {0, 0}, 1, Sum[Sum[If[i^2 + j^2 < n^2 + k^2, b@@Sort[{i, j}], 0], {j, k-1, k+1}], {i, n-1, n+1}]];
a[n_] := b[0, n];
Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Nov 03 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,walk
AUTHOR
Alois P. Heinz, Sep 14 2021
STATUS
approved