OFFSET
0,3
COMMENTS
These walks are not restricted to the first (nonnegative) octant.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..650
Wikipedia, Lattice path
Wikipedia, Self-avoiding walk
EXAMPLE
a(2) = 4: [(0,0,0),(1,0,0),(0,1,1)], [(0,0,0),(0,1,0),(0,1,1)], [(0,0,0),(0,0,1),(0,1,1)], [(0,0,0),(-1,1,1),(0,1,1)].
MAPLE
b:= proc(l) option remember; `if`(l[-1]=0, 1, (r-> add(add(
add(`if`(i+j+k=1, (h-> `if`(add(t, t=h)<0, 0, b(h)))(
sort(l-[i, j, k])), 0), k=r), j=r), i=r))([$-1..1]))
end:
a:= n-> b([floor((n+i)/3)$i=0..2]):
seq(a(n), n=0..24);
MATHEMATICA
b[l_] := b[l] = If[Last[l] == 0, 1, Sum[If[i + j + k == 1, Function[h, If[Total[h] < 0, 0, b[h]]][Sort[l - {i, j, k}]], 0], {i, {-1, 0, 1}}, {j, {-1, 0, 1}}, {k, {-1, 0, 1}}]];
a[n_] := b[Table[Floor[(n + i)/3], {i, 0, 2}]];
a /@ Range[0, 24] (* Jean-François Alcover, May 12 2020, after Maple *)
CROSSREFS
KEYWORD
nonn,walk
AUTHOR
Alois P. Heinz, Oct 13 2019
STATUS
approved