10
$\begingroup$

One day, a friend has shown me a 5 by 5 grid, challenging me to fill it with numbers from 1 to 25.
Obviously, it is not simple because there are some rules:

  • The number 1 is placed in the center of the grid
  • The numbers are placed in ascending order, either by moving two boxes diagonally or moving three boxes in a row or column (as shown in diagram)

5 by 5 grid showing possible moves

How can you achieve that?

$\endgroup$
13
  • 1
    $\begingroup$ What do you mean by "in ascending order"? In which direction? $\endgroup$ Commented Jun 7, 2017 at 13:55
  • 1
    $\begingroup$ And what do these "movements" have to do with filling the grid? $\endgroup$ Commented Jun 7, 2017 at 13:55
  • $\begingroup$ You have to fill the grid with numbers from 1 to 25. You start with the 1 in the center of the grid and you place the others numbers in an ascending order by moving two boxes diagonally or three boxes linearly. Sorry for the lack of precision, it's my first question. $\endgroup$ Commented Jun 7, 2017 at 13:59
  • $\begingroup$ Ah, gotcha. Now I'm sure I've seen this puzzle here before quite recently, but I can't find it! +1 anyway. $\endgroup$ Commented Jun 7, 2017 at 14:00
  • 3
    $\begingroup$ In other words you have to find a knight's tour on the 5x5 chessboard, except that you have to start in the centre, and instead of a knight you have a piece that can do move of the type {0,+-3}, {+-3,0}, and {+-2, +-2}. $\endgroup$ Commented Jun 7, 2017 at 14:37

4 Answers 4

6
$\begingroup$

Definitely not unique, but here's one solution:

\begin{array} & 2 & 17 & 20 & 3 & 16 \\ 12 & 23 & 6 & 13 & 22 \\ 19 & 9 & 1 & 18 & 8 \\ 5 & 14 & 21 & 4 & 15 \\ 11 & 24 & 7 & 10 & 25 \end{array}

Found entirely with trial and error.

$\endgroup$
4
  • 3
    $\begingroup$ Gratz, I calculated with computer there are 352 possible solutions. $\endgroup$
    – shy
    Commented Jun 7, 2017 at 15:22
  • $\begingroup$ @shyos: Are there any solutions where you can jump from the $25$ back to the $1$? $\endgroup$ Commented Jun 7, 2017 at 17:05
  • 3
    $\begingroup$ @JaapScherphuis Sure. Just swap the 23 and 25 in this solution. $\endgroup$
    – user27014
    Commented Jun 7, 2017 at 18:19
  • $\begingroup$ To avoid overcounting rotationally and axially symmetric solutions, why don't we WLOG say that 2 has to go in the TL corner, and hence 3 in the top row? $\endgroup$
    – smci
    Commented Mar 29, 2018 at 21:47
2
$\begingroup$

found another solution by trial and error

\begin{array} & 23 & 17 & 5 & 22 & 16 \\ 12 & 20 & 25 & 13 & 3 \\ 6 & 9 & 1 & 18 & 8 \\ 24 & 14 & 4 & 21 & 15 \\ 11 & 19 & 7 & 10 & 2 \end{array}

I kinda just made "boxes" where I could and used diagonals to transition the progression to the next "box"

$\endgroup$
2
$\begingroup$

Step 1

Name the cells.

enter image description here

Step 2

Make a graph of the possible moves.

enter image description here

Step 3

Rearrange the nodes.

enter image description here

I removed the M. M connects to all four corners. Since we must start at M and then move to a corner we might as well start from the corner.

Step 4

Quite easily find a path visiting all nodes.
We must start from a corner and might as well end at another corner to reconnect to M.

enter image description here

I was surprised to see how few moves remain unused.

Step 5

We now have the sequence: MAPSDLOWHTEBQIXUFRCKNVGJY.
Go back to "square 1" and number the cells accordingly.

enter image description here

$\endgroup$
1
$\begingroup$

It is indeed very similar to a KT (knight's tour). It is necessary to change the move rules, as a proper KT on a 5x5 grid is nearly trivial for an open path, and impossible for a closed path.

I was introduced to the problem in 2017, and became quite fascinated by it - so much that I wrote a program to find all solutions. It found (just as shyos pointed out) that there are 352 solutions when starting in the center (the problem as presented to me stipulated that the starting position could be anywhere on the grid). Of the 352 solutions, 96 were closed paths. By analyzing the program's results I was able to establish a fixed order to try for each successive move that will always lead to a closed path solution from any starting position, with no trial and error (backtracking) needed. If there is still any interest, I can post my algorithm. Here is one (closed path) solution for the center start position:

25 17  7 24 16
12  4 21 13  5
19  9  1 18  8
22 14  6 23 15
11  3 20 10  2
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.