%I #19 Jul 10 2020 03:54:57
%S 1,2,3,11,29,13,31,59,33,61,97,139,191,251,193,141,142,143,101,65,37,
%T 17,5,19,7,23,47,79,49,25,9,8,6,4,14,15,34,35,62,63,98,99,64,66,67,
%U 103,149,201,263,331,409,493,587,586,687,797,689,589,691,591,499,593,501
%N Squares visited by a chess king moving on a square-spiral numbered board where the king moves to the adjacent unvisited square containing the spiral number with the fewest divisors. In case of a tie it chooses the square with the lowest spiral number.
%C 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 lowest spiral number is chosen. Note that if the king simply moves to the smallest available number, as the knight does in A316667, the sequence will be infinite as the king will just follow the square spiral path.
%C The sequence is finite. After 411 steps the square with number 760 is visited, after which all adjacent neighboring squares have been visited.
%C 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 411 visited squares 134 contain prime numbers while 277 contain composites. The largest visited square is a(365) = 3061.
%H Scott R. Shannon, <a href="/A335816/b335816.txt">Table of n, a(n) for n = 1..412</a>
%H Scott R. Shannon, <a href="/A335816/a335816.png">Image showing the 411 steps of the king's path</a>. A green dot marks the starting 1 square and a red dot the final square with number 760. 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 16.
%e The board is numbered with the square spiral:
%e .
%e 17--16--15--14--13 .
%e | | .
%e 18 5---4---3 12 29
%e | | | | |
%e 19 6 1---2 11 28
%e | | | |
%e 20 7---8---9--10 27
%e | |
%e 21--22--23--24--25--26
%e .
%e a(1) = 1, the starting square for the king.
%e a(2) = 2. 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 2 is the smallest.
%e a(4) = 11. The six unvisited squares around a(3) = 3 the king can move to are numbered 4,11,12,13,14,15. Of these 11 and 13 have the minimum two divisors, and of those 11 is the smallest.
%Y Cf. A316667, A330008, A329520, A326922, A328928, A328929.
%K nonn,walk,fini,full
%O 1,2
%A _Scott R. Shannon_, Jun 25 2020