A344230 Squares visited by a knight (chess piece) moving to the lowest-numbered unvisited square at each step on a semi-infinite chessboard numbered by starting in the lower left and filling in squares in a counterclockwise way moving to the bottom leftmost unnumbered square when the edge of the board is encountered.
1, 6, 9, 2, 7, 4, 5, 8, 11, 14, 3, 10, 19, 22, 15, 12, 17, 28, 13, 18, 29, 32, 23, 16, 35, 46, 21, 34, 25, 48, 33, 20, 27, 40, 31, 54, 39, 26, 51, 68, 41, 44, 55, 30, 43, 60, 47, 24, 49, 62, 45, 42, 53, 38, 65, 52, 37, 66, 85, 70, 57, 76, 61, 80, 97, 116, 75, 56, 59, 74, 71, 58, 73, 88, 69, 84, 101, 124, 83, 50, 67, 82, 103, 86, 107, 72, 87, 104, 123, 148, 105, 128, 89, 92, 109, 112, 93, 90, 111, 130, 91, 108, 127, 152, 131, 134, 113, 94, 77, 98, 63, 36
Offset: 1
Links
- N. J. A. Sloane and Brady Haran, The Trapped Knight, Numberphile video (2019).
Crossrefs
Cf. A316667.
Programs
-
Mathematica
findvalue[{i_, j_}] := If[j > i, (j - 1)^2 + 2 j - i, (i - 1)^2 + j]; possiblemoves[{i_, j_}, prev_List] := Block[{moves = {{i + 2, j + 1}, {i + 2, j - 1}, {i + 1, j + 2}, {i + 1, j - 2}, {i - 1, j + 2}, {i - 1, j - 2}, {i - 2, j + 1}, {i - 2, j - 1}}, list}, list = DeleteCases[moves, {x_, y_} /; x < 1 || y < 1]; Complement[list, Intersection[list, prev]]]; findnextmove = Block[{listofmoves = #, nextmove, poss}, pos = possiblemoves[listofmoves[[-1]], listofmoves]; If[Length[pos] > 0, nextmove = Sort[({findvalue[#], #} &) /@ pos][[1, 2]]; AppendTo[listofmoves, nextmove], listofmoves]] &; findvalue /@ FixedPoint[findnextmove, {{1, 1}}]
Comments