

A336494


The number of steps for a walk on a square spiral numbered board when starting on square 1 and stepping to an unvisited square containing the lowest prime number, where the square is within a block of size (2n+1) X (2n+1) centered on the current square. If no unvisited prime numbered squares exist within the block the walk ends.


2



7, 37, 65, 308, 654, 7214, 21992, 49850, 222791, 1146922, 1912101, 6372680, 23077800
(list;
graph;
refs;
listen;
history;
text;
internal format)



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

Table of n, a(n) for n=1..13.
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:
.
1716151413 .
  .
18 543 12 29
    
19 6 12 11 28
   
20 78910 27
 
212223242526
.
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

Cf. A336576 (final square number), A335856, A000040, A136626, A336092, A330979, A332767, A335661, A335364.
Sequence in context: A078626 A093389 A093342 * A086110 A104914 A032588
Adjacent sequences: A336491 A336492 A336493 * A336495 A336496 A336497


KEYWORD

nonn,walk,more


AUTHOR

Scott R. Shannon, Jul 23 2020


STATUS

approved



