cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A336413 Squares visited by a chess rook moving on a square-spiral numbered board where the rook moves to the closest unvisited square containing a prime number. In case of a tie it chooses the square with the smallest prime number.

This page as a plain text file.
%I A336413 #16 Jul 25 2020 09:51:19
%S A336413 1,2,3,5,7,41,43,109,107,103,37,193,191,97,101,199,197,683,677,673,
%T A336413 1753,1747,1429,1427,887,883,661,659,881,877,307,461,463,653,1129,
%U A336413 1733,2083,2081,3323,3319,3797,3793,5419,5417,5413,4297,2861,2857,2447,2069,1723,1721,1409,1123,1117,1399
%N A336413 Squares visited by a chess rook moving on a square-spiral numbered board where the rook moves to the closest unvisited square containing a prime number. In case of a tie it chooses the square with the smallest prime number.
%C A336413 This sequences gives the numbers of the squares visited by a chess rook moving on a square-spiral numbered board where the rook 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 four directions a rook can move on a standard chess board, and the rook 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 rook simply moves to the closest unvisited square the sequence will be infinite as the rook will just follow the square spiral path.
%C A336413 The sequence is finite. After 350 steps the square with number 2179 is visited, after which all four squares the rook can move to have been visited.
%C A336413 The first term where this sequence differs from A336447, where the rook steps to the smallest unvisited prime, is a(7) = 43. See the examples below.
%C A336413 The largest visited square is a(151) = 30539. Both the largest step distance between visited squares, 24 units, and the largest prime gap between visited squares, 6744, occur between a(229) = 2143 and a(230) = 8887. The smallest unvisited prime is 11.
%H A336413 Scott R. Shannon, <a href="/A336413/a336413.png">Image showing the 350 steps of the rook's path</a>. A green square shows the starting 1 square, a red square shows the final square with number 2179, 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 four squares which block the rook'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.
%e A336413 The board is numbered with the square spiral:
%e A336413 .
%e A336413   17--16--15--14--13   .
%e A336413    |               |   .
%e A336413   18   5---4---3  12   29
%e A336413    |   |       |   |   |
%e A336413   19   6   1---2  11   28
%e A336413    |   |           |   |
%e A336413   20   7---8---9--10   27
%e A336413    |                   |
%e A336413   21--22--23--24--25--26
%e A336413 .
%e A336413 a(1) = 1, the starting square for the rook.
%e A336413 a(2) = 2. The four unvisited prime numbered squares around a(1) the rook can move to are numbered 2,61,19,23. Of these 2 is the closest, being 1 unit away.
%e A336413 a(3) = 3. The three unvisited prime numbered squares around a(2) = 2 the rook can move to are numbered 47,11,3. Both 11 and 3 are 1 units away, and of those 3 is the smallest.
%e A336413 a(7) = 43. The three unvisited prime numbered squares around a(6) = 41 the rook can move to are numbered 37,43,107. Both 43 and 107 are 2 units away, and of those 43 is the smallest. Note that 37, the smallest available prime, is 4 units away.
%e A336413 a(230) = 8887. There is only one unvisited prime numbered square around a(229) = 2143 the rook can move to. The square 8887 is 24 units away to the left of 2143.
%Y A336413 Cf. A336402, A336446, A336447, A330979, A000040, A063826, A214664, A214665, A136626, A115258, A331027.
%K A336413 nonn,walk,fini,full
%O A336413 1,2
%A A336413 _Scott R. Shannon_, Jul 21 2020