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.

A337170 Squares visited by knight moves on a diagonally back and forth numbered board and moving to the lowest available unvisited square at every step.

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