OFFSET
1,2
COMMENTS
This sequences gives the numbers of the squares visited by a chess king moving on a square-spiral numbered board where the king starts on the 1 numbered square and at each step moves to an adjacent unvisited square, out of the eight adjacent neighboring squares, which contains the number with the fewest divisors. If two or more adjacent squares exist with the same fewest number of divisors then the square with the largest spiral number is chosen. Note that if the king simply moves to the largest available number the sequence will be infinite as the king will step along the south-east diagonal from square 1 forever.
The sequence is finite. After 21276 steps the square with spiral number 281747427 is visited, after which all adjacent neighboring squares have been visited. The end square is extremely far from the starting square, approximately 8860 units away, as the king is drawn generally outward due to its preference for the largest numbered square when the divisor counts are tied - see the link image. This end square spiral number is currently the largest for any square spiral single-visit trapped knight or trapped king path in the OEIS.
Due to the king's preference for squares with the fewest divisors it will move to a prime numbered square when possible, and the lowest prime if two or more unvisited primes are in adjacent squares. Of the 21276 visited squares 4363 contain prime numbers while 16913 contain composites. The largest visited square is a(21208) = 282486458.
LINKS
Scott R. Shannon, Image showing the 21276 steps of the king's path. A green dot, far lowest left, marks the starting 1 square and a red dot, far upper right, the final square with number 281747427. 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 2. This is a high resolution image and may need to be downloaded to be viewed correctly.
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 king.
a(2) = 7. The eight unvisited squares around a(1) the king can move to are numbered 2,3,4,5,6,7,8,9. Of these 2,3,5,7 have the minimum two divisors, and of those 7 is the largest.
a(3) = 23. The seven unvisited squares around a(2) the king can move to are numbered 6,8,19,20,21,22,23. Of these 19 and 23 have the minimum two divisors, and of those 23 is the largest.
CROSSREFS
KEYWORD
nonn,walk,fini,full
AUTHOR
Scott R. Shannon, Jul 08 2020
STATUS
approved