%I #12 Feb 15 2021 10:21:13
%S 1,11,7,2,6,12,9,3,5,14,8,4,18,33,21,29,24,26,47,10,23,13,19,16,38,34,
%T 17,15,20,30,42,56,45,28,22,31,41,58,44,32,40,35,37,62,66,36,39,60,68,
%U 63,65,98,102,64,67,61,70,93,43,55,46,27,49,52,25,51,78
%N Squares visited by knight moves on a diagonally back and forth numbered board in two quadrants and moving to the lowest available unvisited square at every step.
%C Board is numbered as follows:
%C . 17 16 5 4 1 2 9 10 . .
%C . . 18 15 6 3 8 11 24 . .
%C . . . 19 14 7 12 23 . . .
%C . . . . 20 13 22 . . . .
%C . . . . . 21 . . . . .
%C . . . . . . . . . . .
%C This sequence is finite: At step 4408 square 4077 is visited, after which there are no unvisited squares within one knight move.
%H Sander G. Huisman, <a href="/A341195/b341195.txt">Table of n, a(n) for n = 1..4408</a>
%H N. J. A. Sloane and Brady Haran, <a href="https://www.youtube.com/watch?v=RGQe8waGJ4w">The Trapped Knight</a>, Numberphile video (January, 2019).
%t (* Version 12.0 or higher needed *)
%t ClearAll[ShowRoute,MakeMove,FindSequence]
%t knightjump=Select[Tuples[Range[-2,2],2],Norm[#]==Sqrt[5]&];
%t ShowRoute[output_Association]:=Module[{colors},colors=(ColorData["Rainbow"]/@Subdivide[Length[output["Coordinates"]]-1.0]);
%t Graphics[{Line[output["Coordinates"],VertexColors->colors],Disk[Last@output["Coordinates"],0.2],Style[Disk[Last[output["Coordinates"]]+#,0.2]&/@knightjump,Purple]}]]
%t MakeMove[spiral_Association,visited_List]:=Module[{poss,hj},poss=Table[Last[Last[visited]]+hj,{hj,knightjump}];
%t poss=DeleteMissing[{spiral[#],#}&/@poss,1,\[Infinity]];
%t poss=Select[poss,FreeQ[visited[[All,2]],Last[#]]&];
%t If[Length[poss]>0,First[TakeSmallestBy[poss,First,1]],Missing[]]]
%t FindSequence[start_:{0,0},grid_]:=Module[{positions,j,next},positions={{grid[start],start}};
%t PrintTemporary[Dynamic[j]];
%t Do[next=MakeMove[grid,positions];
%t If[next=!=Missing[],AppendTo[positions,next],Break[];],{j,\[Infinity]}];
%t <|"Coordinates"->positions[[All,2]],"Indices"->positions[[All,1]]|>]
%t grid=ResourceFunction["LatticePointsArrangement"]["DiagonalZigZagEastQ34",20000];
%t grid=Association[MapIndexed[#1->#2[[1]]&,grid]];
%t ShowRoute[fs=FindSequence[{0,0},grid]]
%t fs
%t fs["Indices"]
%t ListPlot[fs["Indices"]]
%Y Cf. A316588, A316328, A316667, A337170.
%K nonn,fini,full
%O 1,2
%A _Sander G. Huisman_, Feb 06 2021