[go: up one dir, main page]

login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 1
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, 17, 15, 20, 30, 42, 56, 45, 28, 22, 31, 41, 58, 44, 32, 40, 35, 37, 62, 66, 36, 39, 60, 68, 63, 65, 98, 102, 64, 67, 61, 70, 93, 43, 55, 46, 27, 49, 52, 25, 51, 78 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Board is numbered as follows:
. 17 16 5 4 1 2 9 10 . .
. . 18 15 6 3 8 11 24 . .
. . . 19 14 7 12 23 . . .
. . . . 20 13 22 . . . .
. . . . . 21 . . . . .
. . . . . . . . . . .
This sequence is finite: At step 4408 square 4077 is visited, after which there are no unvisited squares within one knight move.
LINKS
N. J. A. Sloane and Brady Haran, The Trapped Knight, Numberphile video (January, 2019).
MATHEMATICA
(* Version 12.0 or higher needed *)
ClearAll[ShowRoute, MakeMove, FindSequence]
knightjump=Select[Tuples[Range[-2, 2], 2], Norm[#]==Sqrt[5]&];
ShowRoute[output_Association]:=Module[{colors}, colors=(ColorData["Rainbow"]/@Subdivide[Length[output["Coordinates"]]-1.0]);
Graphics[{Line[output["Coordinates"], VertexColors->colors], Disk[Last@output["Coordinates"], 0.2], Style[Disk[Last[output["Coordinates"]]+#, 0.2]&/@knightjump, Purple]}]]
MakeMove[spiral_Association, visited_List]:=Module[{poss, hj}, poss=Table[Last[Last[visited]]+hj, {hj, knightjump}];
poss=DeleteMissing[{spiral[#], #}&/@poss, 1, \[Infinity]];
poss=Select[poss, FreeQ[visited[[All, 2]], Last[#]]&];
If[Length[poss]>0, First[TakeSmallestBy[poss, First, 1]], Missing[]]]
FindSequence[start_:{0, 0}, grid_]:=Module[{positions, j, next}, positions={{grid[start], start}};
PrintTemporary[Dynamic[j]];
Do[next=MakeMove[grid, positions];
If[next=!=Missing[], AppendTo[positions, next], Break[]; ], {j, \[Infinity]}];
<|"Coordinates"->positions[[All, 2]], "Indices"->positions[[All, 1]]|>]
grid=ResourceFunction["LatticePointsArrangement"]["DiagonalZigZagEastQ34", 20000];
grid=Association[MapIndexed[#1->#2[[1]]&, grid]];
ShowRoute[fs=FindSequence[{0, 0}, grid]]
fs
fs["Indices"]
ListPlot[fs["Indices"]]
CROSSREFS
Sequence in context: A356705 A038320 A010185 * A005603 A109828 A048981
KEYWORD
nonn,fini,full
AUTHOR
Sander G. Huisman, Feb 06 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 29 17:19 EDT 2024. Contains 375518 sequences. (Running on oeis4.)