Consider a knight on an infinite chessboard labeled with numbers spiraling outward. A knight starting on the square labeled 1 can reach 8 squares, marked in green below (i.e., squares 10, 12, 14, 16, 18, 20, 22, and 24). Take the smallest of these numbers, or 10. Repeating the step while avoiding squares already visited puts the knight at squares 3, 6, 9, 4, 7, 2, 5, etc. This tour continues until step 2016, when the knight reaches square 2084. At that point the knight is trapped: it has visited all eight possible squares.
Write a function that takes the starting square and returns the sequence of squares visited by the knight on the tour.

Solution Stats

28 Solutions

7 Solvers

Last Solution submitted on Feb 03, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...