How did the criminals escape from the jail?

There are $$72$$ criminals in a jail in $$8$$ cells as shown in the picture above. There are $$9$$ criminals in each cell. There are $$4$$ guards. Each of them watch over the $$4$$ corridors. As there is a door between every two adjacent cells, the criminals of a cell can go to another cells. So, a guard never counts the number of criminals in a cell. Rather, he looks if there is a total of $$9\cdot 3=27$$ criminals in his corridor. The criminals knew it and they planned for an escape from the jail. So, they started to escape from the jail in groups of $$4$$ criminals such that none of the guards got to know this.

How did they do it and at most how many criminals could escape without any suspicion of the guards?

• I feel that this question must have been asked before since it is such a classic puzzle, but none of my searches have turned up anything. Commented May 5, 2021 at 14:54
• Is it a classic problem? I didn't know that @JaapScherphuis Commented May 5, 2021 at 14:58
• Not sure, but this should be 'exactly 4' as in the question statement. @Trenin Commented May 5, 2021 at 15:23
• can escaped criminals come back into the jail to help others? i.e. 4 escaped, 2 came back, and 4 more escaped? Commented May 5, 2021 at 16:57
• Yes, this is possible as it's a puzzle. And that's a good idea indeed. @rhavelka Commented May 5, 2021 at 17:24

Number of escaped Prisoners

16

Here is a step by step answer with a visual:

Step 1 is the initial board.
Step 2 will have 4 people on the center left going down to the bottom left, while 4 people in the center bottom escaping together as a group.
Step 3 will similarly have 4 people on the center right going up to the top right, while 4 people in the center top escaping together as a group.
Steps 4 and 5 are steps 2 and 3 repeated.

Alternate Solutions:

You can have different configurations for the final solution. This is under the assumption that 4 people can escape without having to be in the same cell (i.e. they don't all have to escape "together" as long as they escape "at the same time")

Second Solution with some assumptions

Assumption 1: One "group" means at the same time, not necessarily from the same cell.
Assumption 2: Escaped convicts can come back in at any time without a group (as it is not stated they can't).

Number of escaped Prisoners

18

Here is a step by step answer with a visual:

Step 1-5 see above
Step 6 Two convicts come back in, one from the top and one from the bottom while two convicts on the corners move to the center squares.
Step 7 two convicts from the top right and bottom left corners exits while all of the center cells are reduced to 0.

One way it could be accomplished:

From the four cells in the middle of each corridor, 1 prisoner escapes and 1 prisoner moves clockwise into an adjacent corner cell. Then the 4 middle cells have 9 - 2 = 7 prisoners each, and the 4 corner cells have 9 + 1 = 10 prisoners each. Each guard still sees 10 + 10 + 7 = 27 prisoners, but in fact 4 have escaped and there are 4x10 + 4x7 = 68 prisoners left.

Followed by:

The prisoners repeat this process again, leaving 11 prisoners in each corner and 5 in each middle cell, then again leaving 12 in each corner and 3 in each middle cell, and once more, leaving 13 in each corner and 1 in each middle cell. At all times the guards still see 27 prisoners in their corridor but 4 more prisoners escape at each step. In the end there are 4x13 + 4x1 = 56 prisoners remaining, and a total of 16 have escaped.

But wait:

(If the puzzle allowed for this) two more prisoners can escape at the end, while the remaining 54 split themselves evenly between two diagonally-opposite corners. Then each guard still sees 27 but a total of 18 have escaped. No more could escape, because then there would be fewer than 54 remaining, which couldn't be arranged in such a way that all four guards would see 27 of them.

• two more can escape but the prisoners only escape in groups of 4.
– Sid
Commented May 5, 2021 at 15:04
• Yes, that's an important point. @Sid Commented May 5, 2021 at 15:11

It is not mentioned, so I assume that prisoners can escape from the prison from any cell. Also, they can only escape in groups of 4 at a time.

First, all the prisoners will divide themselves up into 9/cell. Amongst themselves, they will all order themselves. Now, we will pick two opposite corner cells - lets say the top left and bottom right. Unfortunately for them, these prisoners are stuck and will never get free. We will label them as 'P' for 'Permanent prisoner'. The other corners we will label a-i. The sides are numbered 1-9. So we have the following:

PPP|123|abc
PPP|456|def
PPP|789|ghi
---+---+---
123|   |123
456|   |456
789|   |789
---+---+---
abc|123|PPP
def|456|PPP
ghi|789|PPP


More concisely:

Px9  | 1-9 | a-i
-----+-----+-----
1-9  |     | 1-9
-----+-----+-----
a-i  | 1-9 | Px9


Now that the prisoners have numbered themselves, the following things will happen simultaneously:

• The 2 lowest lettered prisoners in the corners (a&b) escape!
• The 2 lowest numbered prisoners in the sides (1&2) shift towards the nearest corner.

Then we have:

PPP1|  3|  c
PPP2|456|def
PPP |789|ghi
12  |   |
----+---+---
3 |   |  3
456 |   |456
789 |   |789
----+---+---
c |  3|PPP1
def |456|PPP2
ghi |789|PPP
|   |12


Or more concisely:

Px13 | 3-9 | c-i
-----+-----+-----
3-9  |     | 3-9
-----+-----+-----
c-i  | 3-9 | Px13


Each row and column still contains 27 prisoners; $$13+7+7 = 9+9+9 = 27$$.

Repeat this process 3 more times. Then we will have;

Px25 | 9 | i
-----+-----+-----
9   |   | 9
-----+-----+-----
i   | 9 | Px25


There are still 27 prisoners in each row and column ($$25+1+1=27$$), and $$4 \times 4 = 16$$ prisoners have escaped.

The best I could come up with was that 16 prisoners escaped. 2 prisoners from the inside boxes (non corners) would each move clockwise(or counter) to the adjacent corner cell at the same time 1 prisoner would move from the corner cell out to escape. This would keep the prisoner counts at 27 on each side at all times with 1 prisoner from each corner escaping at each iteration. The inside cells would go from 9>7>5>3>1 meanwhile the corner cells would increment by 1 from 9>10>11>12>13.

In the end we have the matrix look like:

13 1 13
1  x 1
13 1 13