OFFSET
1,2
COMMENTS
The first step is in the +x direction, the first orthogonal step is in the +y direction, and the first step orthogonal to both x and y is in the +z direction.
EXAMPLE
There are 30 SAWs of length 2 (6 straight and 24 bent), but they can all be rotated such that the first step is in the +x direction, reducing the count to 5. Of these 5, one is straight and four are bent. The four bent walks can all be rotated such that their second step is in the +y direction, leaving the count at 2.
PROG
(Python)
import numpy as np
from copy import copy
nmax=10
count=[1, 2]
allwalks=[]
lap=lambda f, *l: list(map(f, *l))
allwalks.append(np.array([1, 0, 0]))
allwalks.append(np.array([[[1, 0, 0], [1, 1, 0]], [[1, 0, 0], [2, 0, 0]]]))
for n in range(2, nmax):
template=allwalks[n-1]
counter=0
walks=[]
for t in template:
prewalk=np.array(t, dtype=int)
ytrig=np.max(prewalk[:, 1])>0
ztrig=np.max(prewalk[:, 2])>0
grid=np.zeros([2*nmax+2]*3)
prewalk+=nmax+1
grid[*3*[nmax+1]]=1
for j in range(n):
grid[prewalk[j, 0], prewalk[j, 1], prewalk[j, 2]]=1
opts=[]
ep=[prewalk[-1, 0], prewalk[-1, 1], prewalk[-1, 2]]
for i in range(6):
epp=copy(ep)
epp[i//2]+=(-1)**i
if grid[*epp]==0 and (i<3 or ytrig and (i<5 or ztrig)):
opts.append(epp)
for o in opts:
counter+=1
walk=np.zeros([n+1, 3])
walk[0:-1, :]=prewalk-[nmax+1]*3
walk[-1, :]=np.array(o)-[nmax+1]*3
walks.append(walk)
allwalks.append(walks)
count.append(counter)
print(count)
CROSSREFS
KEYWORD
nonn,walk
AUTHOR
Alex Klotz, Mar 17 2026
STATUS
approved
