A306659 x-coordinates of a counterclockwise knight's tour on an infinite board starting at the origin and then successively visiting fields in concentric rings of width 2. y-coordinates are in A306660.
0, 2, 0, -2, -1, 1, 2, 1, -1, -2, 0, 2, 1, -1, -2, -1, 1, 0, -2, -1, -2, 0, 2, 1, 2, 3, 1, -1, -3, -4, -3, -4, -2, 0, 2, 4, 3, 4, 3, 1, -1, -3, -4, -3, -4, -3, -1, 1, 3, 4, 3, 4, 2, 0, -2, -4, -3, -4, -3, -1, 1, 3, 4, 3, 4, 2, 0, -2, -4, -3, -4, -3, -4, -2, 0
Offset: 1
Keywords
Links
- Hugo Pfoertner, Table of n, a(n) for n = 1..1089
- Hugo Pfoertner, Illustration of knight's tour on 13 X 13 board.
- Jay Warendorff, An Infinite Knight's Tour, Wolfram Demonstrations Project, March 7 2011.
Programs
-
PARI
atan2(y,x)=if(x>0,atan(y/x),if(x==0,if(y>0,Pi/2,-Pi/2),if(y>=0,atan(y/x)+Pi,atan(y/x)-Pi))); angle(v,w)=atan2(v[1]*w[2]-v[2]*w[1],v[1]*w[1]+v[2]*w[2]); move=[2,1;1,2;-1,2;-2,1;-2,-1;-1,-2;1,-2;2,-1]; \\ 8 Knight moves m=6; \\ Extension of board - 2 b=matrix(2*m+1,2*m+1,i,j,0); \\ Visited fields ptarget=1; \\ change to 2 to print A306660 setb(pos)={b[pos[1]+m+1,pos[2]+m+1]=1}; \\ Mark visited fields getb(pos)=b[pos[1]+m+1,pos[2]+m+1]; \\ Check visited fields inring(n,p)=!(abs(p[1])
=0,if(adiff 0,p+=move[jmin,];setb(p);););p+=move[jlast,];setb(p));
Comments