OFFSET
0,2
COMMENTS
All terms are odd.
LINKS
Ricardo Bittencourt, C++ code, GitHubGist.
Ricardo Bittencourt, Go code, GitHubGist.
OEIS Wiki: Self-avoiding walks
FORMULA
EXAMPLE
For n=2, the a(2)=15 paths are:
.
. 0 . . 0 . . 0 . . 0 2 . 0 . .
. | | | |/ \
. 1 . . 1 . . 1-2 . 1 . . 2-1 .
. | \
. 2 . . . 2 . . . . . . . . . .
.
. 0 . . 0 . . 0 . . 0 . . 0 . 2
. \ \ \ \ \ /
. . 1 . . 1 . . 1 . . 1-2 . 1 .
. / | \
. 2 . . . 2 . . . 2 . . . . . .
.
. 0 2 . 0-1 . 0-1 . 0-1 . 0-1-2
. \| / | \
. . 1 . 2 . . . 2 . . . 2 . . .
.
. . . . . . . . . . . . . . . .
MATHEMATICA
next[x_]:=Map[x + #&, Tuples[{-1, 0, 1}, 2]]
valid[s_]:=Select[next[s[[-1]]], 0<=#[[1]] && 0<=#[[2]] && FreeQ[s, #] &]
nextpath[p_]:=Outer[Append, {p}, valid[p], 1]
iterate[p_]:=Flatten[Map[nextpath, p], 2]
Table[Length[Nest[iterate, {{{0, 0}}}, n-1]], {n, 1, 7}]
PROG
(C++) (see GitHubGist link)
(Go) (see GitHubGist link)
CROSSREFS
KEYWORD
nonn,walk,more
AUTHOR
Ricardo Bittencourt, Mar 10 2018
STATUS
approved