MathPuzzle

Free puzzles / Question / Magic Squares Problem.

Eight Jolly Gaol Birds.

The illustration shows the plan of a prison of nine cells all communicating with one another by doorways. The eight prisoners have their numbers on their backs, and any one of them is allowed to exercise himself in whichever cell may happen to be vacant, subject to the rule that at no time shall two prisoners be in the same cell. The merry monarch in whose dominions the prison was situated offered them special comforts one Christmas Eve if, without breaking that rule, they could so place themselves that their numbers should form a magic square. Now, prisoner No. 7 happened to know a good deal about magic squares, so he worked out a scheme and naturally selected the method that was most expeditious--that is, one involving the fewest possible moves from cell to cell. But one man was a surly, obstinate fellow (quite unfit for the society of his jovial companions), and he refused to move out of his cell or take any part in the proceedings. But No. 7 was quite equal to the emergency, and found that he could still do what was required in the fewest possible moves without troubling the brute to leave his cell. The puzzle is to show how he did it and, incidentally, to discover which prisoner was so stupidly obstinate. Can you find the fellow?

Answer

There is a pitfall set for the unwary in this little puzzle. At the start one man is allowed to be placed on the shoulders of another, so as to give always one empty cell to enable the prisoners to move about without any two ever being in a cell together. The two united prisoners are allowed to add their numbers together, and are, of course, permitted to remain together at the completion of the magic square. But they are obviously not compelled so to remain together, provided that one of the pair on his final move does not break the condition of entering a cell already occupied. After the acute solver has noticed this point, it is for him to determine which method is the better one--for the two to be together at the count or to separate. As a matter of fact, the puzzle can be solved in seventeen moves if the men are to remain together; but if they separate at the end, they may actually save a move and perform the feat in sixteen! The trick consists in placing the man in the centre on the back of one of the corner men, and then working the pair into the centre before their final separation. [Illustration: A B +---+---+---+ +---+---+---+ | | | | | | | | | 2 9 4 | | 6 7 2 | | | | | | | | | +- -+- -+- -+ +- -+- -+- -+ | | | | | | | | | 7 5 3 | | 1 5 9 | | | | | | | | | +- -+- -+- -+ +- -+- -+- -+ | | | | | | | | | 6 1 8 | | 8 3 4 | | | | | | | | | +---+---+---+ +---+---+---+ ] Here are the moves for getting the men into one or other of the above two positions. The numbers are those of the men in the order in which they move into the cell that is for the time being vacant. The pair is shown in brackets:-- Place 5 on 1. Then, 6, 9, 8, 6, 4, (6), 2, 4, 9, 3, 4, 9, (6), 7, 6, 1. Place 5 on 9. Then, 4, 1, 2, 4, 6, (14), 8, 6, 1, 7, 6, 1, (14), 3, 4, 9. Place 5 on 3. Then, 6, (8), 2, 6, 4, 7, 8, 4, 7, 1, 6, 7, (8), 9, 4, 3. Place 5 on 7. Then, 4, (12), 8, 4, 6, 3, 2, 6, 3, 9, 4, 3, (12), 1, 6, 7. The first and second solutions produce Diagram A; the second and third produce Diagram B. There are only sixteen moves in every case. Having found the fewest moves, we had to consider how we were to make the burdened man do as little work as possible. It will at once be seen that as the pair have to go into the centre before separating they must take at fewest two moves. The labour of the burdened man can only be reduced by adopting the other method of solution, which, however, forces us to take another move.