

A335856


Squares visited by a chess king moving on a squarespiral numbered board where the king moves to the adjacent unvisited square containing the lowest prime number. In no adjacent prime numbered squares are present it chooses the lowest spiral number.


3



1, 2, 3, 11, 29, 13, 31, 59, 32, 14, 4, 5, 17, 37, 67, 103, 149, 104, 66, 38, 18, 19, 7, 23, 47, 79, 48, 24, 8, 6, 20, 41, 71, 43, 73, 109, 72, 42, 21, 22, 44, 45, 46, 76, 75, 113, 74, 112, 110, 111, 157, 211, 271, 209, 269, 337, 267, 205, 151, 107, 69, 39, 40
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

This sequences gives the numbers of the squares visited by a chess king moving on a squarespiral numbered board where the king starts on the 1 numbered square and at each step moves to the adjacent unvisited square containing the lowest prime number. If no adjacent unvisited square contains a prime number then the square with the lowest spiral number is chosen. Note that if the king simply moves to the lowest unvisited number the sequence will be infinite as the king will just follow the square spiral path.
The sequence is finite. After 719 steps the square with number 437 is visited, after which all adjacent neighboring squares have been visited.
Of the 719 visited squares 165 contain prime numbers while 554 contain composites. As the odd numbers are diagonally adjacent in the square spiral the king's path will contain many diagonal steps, often taking numerous diagonal steps is succession  see the attached link image.
The largest visited square is a(709) = 1367. The lowest unvisited square is 33.
The 719 steps until selftrapping occurs are significantly larger than the expected average of 210 moves to selftrapping for a random walk of the king on an infinite chessboard. See the link to the probability density graphs in A323562.  Hugo Pfoertner, Jul 19 2020


LINKS

Table of n, a(n) for n=1..63.
Scott R. Shannon, Image showing the 719 steps of the path. A green dot marks the starting 1 square and a red dot the final square with number 437. The red dot is surrounded by eight blue dots to show the occupied neighboring squares. A yellow dots marks the smallest unvisited square with number 33.


EXAMPLE

The board is numbered with the square spiral:
.
1716151413 .
  .
18 543 12 29
    
19 6 12 11 28
   
20 78910 27
 
212223242526
.
a(1) = 1, the starting square for the king.
a(2) = 2. The four unvisited squares around a(1) the king can move which contain prime numbers are 2,3,5,7. Of those 2 is the lowest.
a(4) = 11. The two unvisited squares around a(3) = 3 the king can move to which contain prime numbers are 11 and 13. Of those 11 is the lowest.
a(9) = 32. There are no unvisited squares around a(8) = 59 which contain prime numbers. The seven other unvisited squares are numbered 32,33,58,60,93,94,95. Of those 32 is the lowest.


CROSSREFS

Cf. A333714, A333713, A335816, A336038, A336092, A316667.
Cf. A174344, A274923, A272763, A323561, A323562.
Sequence in context: A232219 A265095 A301804 * A335816 A330979 A336402
Adjacent sequences: A335853 A335854 A335855 * A335857 A335858 A335859


KEYWORD

nonn,walk,fini,full


AUTHOR

Scott R. Shannon, Jun 27 2020


STATUS

approved



