OFFSET
1,1
COMMENTS
For n = 1 this sequence is similar to A335856 except that only prime numbers can be stepped to; if no adjacent prime number exists then the walk ends. In general for a(n) the walk can step to any unvisited square containing the lowest prime number within a block of size (2n+1) X (2n+1) centered on the current square.
See A336576 for the final square number of the walks.
LINKS
Scott R. Shannon, Image showing the 7 steps of the walk for n = 1. For this and other images a green square shows the starting 1 square, a red square shows the final square, and a thick white line is the path between visited squares. All visited prime numbered squares are shown in yellow, while those unvisited squares containing primes are shown in grey. Blue squares mark out the (2n+1)x(2n+1) block of squares around the final square which contains no further unvisited primes. The square spiral numbering of the board is shown as a thin white line.
Scott R. Shannon, Image showing the 37 steps of the walk for n = 2. Click on this and other images to zoom in.
Scott R. Shannon, Image showing the 65 steps of the walk for n = 3.
Scott R. Shannon, Image showing the 308 steps of the walk for n = 4.
Scott R. Shannon, Image showing the 654 steps of the walk for n = 5.
Scott R. Shannon, Image showing the 7214 steps of the walk for n = 6.
Wikipedia, Ulam Spiral.
EXAMPLE
The board is numbered with the square spiral:
.
17--16--15--14--13 .
| | .
18 5---4---3 12 29
| | | | |
19 6 1---2 11 28
| | | |
20 7---8---9--10 27
| |
21--22--23--24--25--26
.
a(1) = 7. Starting from the square 1 the sequence of adjacent unvisited lowest primes the walk can step to are 2,3,11,29,13,31,59. Once the square 59 is visited there are no other unvisited adjacent squares containing primes, so the walk terminates after 7 steps. See the first linked image.
a(2) = 38. This walk also starts by stepping to 2 and then 3. But the next lowest prime 5 is now two units away so is reachable and is thus the next stepped to square. Further steps are 7,19,17,37...,827,829,719,947. Once the square 947 is visited there are no other unvisited squares containing primes within the surrounding 5x5 block of squares, so the walk terminates after 38 steps. See the second linked image.
Also see the linked images for n=3,4,5,6.
CROSSREFS
KEYWORD
nonn,walk,more
AUTHOR
Scott R. Shannon, Jul 23 2020
STATUS
approved