login
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.
0
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,2
COMMENTS
The sequence is finite and ends at the 111th move, which takes the knight to the square numbered 36 (the leftmost square on the 6th row).
The squares on the board are numbered as follows:
. . . . . . .
. . . . . . .
. . . . . . .
+----+----+----+----+----+----+----+
| 49 | 48 | 47 | 46 | 45 | 44 | 43 | ...
ending +----+----+----+----+----+----+----+
square ---> | 36 | 35 | 34 | 33 | 32 | 31 | 42 | ...
+----+----+----+----+----+----+----+
| 25 | 24 | 23 | 22 | 21 | 30 | 41 | ...
+----+----+----+----+----+----+----+
| 16 | 15 | 14 | 13 | 20 | 29 | 40 | ...
+----+----+----+----+----+----+----+
| 9 | 8 | 7 | 12 | 19 | 28 | 39 | ...
+----+----+----+----+----+----+----+
| 4 | 3 | 6 | 11 | 18 | 27 | 38 | ...
starting +----+----+----+----+----+----+----+
square ---> | 1 | 2 | 5 | 10 | 17 | 26 | 37 | ...
+----+----+----+----+----+----+----+
LINKS
N. J. A. Sloane and Brady Haran, The Trapped Knight, Numberphile video (2019).
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}}]
CROSSREFS
Cf. A316667.
Sequence in context: A198676 A198616 A215668 * A010502 A254292 A188618
KEYWORD
nonn,fini,full,walk
AUTHOR
Roman Mecholsky, May 12 2021
STATUS
approved