login
A336402
Squares visited by a chess queen moving on a square-spiral numbered board where the queen moves to the closest unvisited square containing a prime number. In case of a tie it chooses the square with the smallest prime number.
4
1, 2, 3, 11, 29, 13, 31, 59, 61, 97, 139, 191, 251, 193, 101, 103, 67, 37, 17, 5, 19, 7, 23, 47, 79, 163, 281, 353, 283, 433, 521, 617, 523, 619, 439, 359, 223, 167, 227, 293, 229, 173, 83, 233, 127, 53, 179, 131, 89, 137, 389, 313, 311, 467, 383, 307, 241, 239, 181, 457, 547, 643
OFFSET
1,2
COMMENTS
This sequences gives the numbers of the squares visited by a chess queen moving on a square-spiral numbered board where the queen starts on the 1 numbered square and at each step moves to the closest unvisited square containing a prime number. The movement is restricted to the eight directions a queen can move on a standard chess board, and the queen cannot move over a previously visited square If two or more unvisited prime numbered squares exist which are the same distance from the current square then the one with the smallest prime number is chosen. Note that if the queen simply moves to the closest unvisited square the sequence will be infinite as the queen will just follow the square spiral path.
The sequence is finite. After 519 steps the square with number 1289 is visited, after which all eight squares the queen can move to have been visited.
The first term where this sequence differs from A330979, which steps to the closest unvisited prime without any movement direction restrictions, is a(40) = 227. See the examples below.
The largest visited square is a(292) = 14843. The largest step distance between visited squares is 20 units, between a(338) = 2879 to a(339) = 3779. The largest prime gap between visited squares is 4050, from a(396) = 10667 to a(397) = 14717. The smallest unvisited prime is 41.
LINKS
Scott R. Shannon, Image showing the 519 steps of the queen's path. A green square shows the starting 1 square, a red square shows the final square with number 1289, 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. The eight squares which block the queen's movement from the final square are shown with a red border. The square spiral numbering of the board is shown as a thin white line. Click on the image to zoom in to see the prime numbers.
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) = 1, the starting square for the queen.
a(2) = 2. The seven unvisited prime numbered squares around a(1) the queen can move to are numbered 2,3,61,5,19,7,23. Of these 2 is the closest, being 1 unit away. There are no primes in the south-east direction from a(1).
a(4) = 11. The four unvisited prime numbered squares around a(3) = 3 the queen can move to are numbered 11,29,13,5, the other two directions not having any primes. Both 11 and 13 are sqrt(2) units away, and of those 11 is the smallest.
a(40) = 227. The three unvisited prime numbered squares around a(39) = 167 the queen can move to are numbered 227,173,53, Of these 227 is the closest, being 4 units away. Note that the square with prime number 83 is only sqrt(10), about 3.16, units away but is at relative coordinates (1,3) to 167 so cannot be reach by the queen.
KEYWORD
nonn,walk,fini,full
AUTHOR
Scott R. Shannon, Jul 20 2020
STATUS
approved