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.

A341195 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.

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