%I #40 Mar 31 2024 19:04:16
%S 0,5,2,1,2,1,2,1,2,1,4,5,10,13,4,5,10,5,10,5,4,13,10,5,10,13,4,5,10,
%T 13,16,13,10,5,16,13,20,9,8,9,8,9,8,9,8,17,18,17,26,25,20,25,10,13,16,
%U 29,18,17,26,25,20,25,20,13,16,29,18,17,26,25,20,25,40,41,34,37,50,29,18,17,26,25,20,25,20,25,26,37,34,25,26,17,34,25,26,17,34,25,20,37
%N Squares visited by a knight moving on a board with squares labeled with their squared distance from the origin and where the knight moves to the smallest labeled unvisited square; the smallest spiral number ordering is used if the distances are equal.
%C This sequence uses the squared distance from the origin to label the squares. At each step the knight goes to an unvisited square with the smallest label; if there are two or more squares with the same label it then chooses the square with the smallest number if the board was numbered as a spiral, i.e., the smallest spiral numbered square as in A316667.
%C The sequence is finite. After 22325 steps a square with label 6885 (spiral number = 25984) is visited, after which all neighboring squares have been visited.
%C If one looks at the spiral number for the visited squares in this sequence one finds it is the same as A316667 for the first 34 steps. On the 35th step this sequence goes to a square with spiral number 77, which is 4 units from the origin, while A316667 goes to square 43, which is sqrt(18) (> 4) units from the origin.
%C Sequence A326924 gives the number of the square visited at the n-th move, which is at distance^2 a(n) from the origin, cf. formula. - _M. F. Hasler_, Oct 22 2019
%H Scott R. Shannon, <a href="/A326922/b326922.txt">Table of n, a(n) for n = 0..22325</a> [The complete sequence]
%H Scott R. Shannon, <a href="/A326922/a326922.png">Image showing the 22325 steps of the knight's path</a>. The green dot is the first square with number 0 and the red dot the last 22326th square with number 6885. The red dot is surrounded by blue dots to show the eight occupied squares. [The red dot is near the boundary at about 4 o'clock.]
%H N. J. A. Sloane and Brady Haran, <a href="https://www.youtube.com/watch?v=RGQe8waGJ4w">The Trapped Knight</a>, Numberphile video (2019).
%F a(n) = A174344(A326924(n))^2 + A274923(A326924(n))^2. - _M. F. Hasler_, Oct 22 2019
%e The squares are labeled using their squared distance from the origin:
%e .
%e +----+----+----+----+----+----+----+
%e | 18 | 13 | 10 | 9 | 10 | 13 | 18 |
%e +----+----+----+----+----+----+----+
%e | 13 | 8 | 5 | 4 | 5 | 8 | 13 |
%e +----+----+----+----+----+----+----+
%e | 10 | 5 | 2 | 1 | 2 | 5 | 10 |
%e +----+----+----+----+----+----+----+
%e | 9 | 4 | 1 | 0 | 1 | 4 | 9 |
%e +----+----+----+----+----+----+----+
%e | 10 | 5 | 2 | 1 | 2 | 5 | 10 |
%e +----+----+----+----+----+----+----+
%e | 13 | 8 | 5 | 4 | 5 | 8 | 13 |
%e +----+----+----+----+----+----+----+
%e | 18 | 13 | 10 | 9 | 10 | 13 | 18 |
%e +----+----+----+----+----+----+----+
%e .
%e If the knight has a choice of two or more squares with the same label (same squared distance from the origin), then the square with the minimum spiral number, as shown in A316667, is chosen.
%o (PARI) A326922(n)=norml2(coords(A326924(n))) \\ with coords() defined in A296030, or see formula. - _M. F. Hasler_, Oct 22 2019
%Y Cf. A316667, A326413, A326916, A326918, A326924.
%Y Cf. A174344, A274923, A296030 (coordinates of the square number n).
%K nonn,fini,full
%O 0,2
%A _Scott R. Shannon_, Oct 21 2019