Counting Towns from a Tower
The evil king, no longer trusting his 2 wise men, wants to test their wisdom, so he locks them in a tall tower in the middle of his kingdom. One wise man is put into a cell facing the north, while the other is put in a cell facing the south. Through a tiny window in each of their cells, they could collectively see all the towns in the kingdom with no overlap.
The king briefs each wise man with what he was going to do. Every evening, he would come to their cells. If either of the wise men knew the total number of towns in the kingdom, they would be freed that very evening. But if either of them gave a wrong answer, they would be put to death. For a final clue, the king tells them that there were either 10 or 13 towns in his kingdom.
There were no guesses on the first, second, third, and fourth days. However, on the evening of the fifth day, they were freed. How? And how many towns are there in the kingdom?
Hint
There are no tricks involved—no secret communication by tapping on the walls of the tower, etc. Everything is done through pure logic.
Solution
There are 13 towns in the kingdom.
To understand the logic used to solve this, let’s start with a concrete example. Let’s say you’re one of the wise men, and through your window you see 2 towns. Since the total number of towns is either 10 or 13, you know the other wise man sees either 8 or 11 towns. However, if the other wise man sees 11 towns, he’d immediately know that there must be 13 towns in total, and you’d both be free by the evening of the first day. If it’s day 2, and you’re both not yet free, then you know he must not be seeing 11 towns, and so you can conclude that he must be seeing 8 towns, and there are 10 towns in total. The lack of response from the other wise man is information that you could use.
Now let’s step back and examine all the scenarios that the wise men could encounter, as well as the way the towns are split between them:
| 10 towns: | 0+10 | 1+9 | 2+8 | 3+7 | 4+6 | 5+5 | |
| 13 towns: | 0+13 | 1+12 | 2+11 | 3+10 | 4+9 | 5+8 | 6+7 |
As with the earlier logic, if either of the wise men saw 11 towns through their window, it’d immediately be obvious that the total number of towns must be 13. In fact, we can extend the same logic to seeing 12 and 13 towns too. After the first day, if the wise men are not freed, they can both conclude that they are not in the scenario where there are 13 towns in the following splits: 0+13, 1+12, or 2+11.
| 10 towns: | 0+10 | 1+9 | 2+8 | 3+7 | 4+6 | 5+5 | |
| 13 towns: | 3+10 | 4+9 | 5+8 | 6+7 |
Now we see that if any of the wise men saw 0, 1, or 2 towns, then they’d know by day 2 that they were in the scenario with 10 towns.
What happens then if they’re not freed by day 2? Then it’s impossible that any of the wise men saw 0, 1, or 2 towns through their window. This means we can eliminate the scenarios with 10 towns in the following splits: 0+10, 1+9, 2+8
| 10 towns: | 3+7 | 4+6 | 5+5 | ||||
| 13 towns: | 3+10 | 4+9 | 5+8 | 6+7 |
We continue the logic. On day 3, if any of the wise men saw 8, 9, or 10 towns through their window, they’d now know that they can’t be in the 2+8, 1+9, or 0+10 scenarios. Meaning that they must be in the 3+10, 4+9, or 5+8 scenarios with 13 towns, and they can report it on the evening of the 3rd day. But if the 4th day arrives and both wise men have not been freed, then we can eliminate those scenarios too.
| 10 towns: | 3+7 | 4+6 | 5+5 | ||||
| 13 towns: | 6+7 |
You know the drill. On day 4, if any of the wise men saw 3, 4, or 5 towns through their window, then they know that there are 10 towns in total, and they’d be freed that evening. But if they found themselves still in their cells on day 5, then we know that this cannot be the case.
|||||||||
|10 towns:|0+10|1+9|2+8|3+7|4+6|5+5||
|13 towns:|0+13|1+12|2+11|3+10|4+9|5+8|6+7|
It’s day 5, and now the only scenario that remains is that there are 13 towns in total, with one wise man seeing 6 towns and the other seeing 7 towns. That evening, the answer is given, and they’re both freed.
Try These Next
Chomp 1
You are playing a dangerous game with a friend. He pulls out a chocolate bar comprising 6 squares arranged in a 3 by 2 arrangement. The bottom-left square is...
Ant in a Cube
An ant is at one corner of a cube with side length 1. The exit is a tiny hole on the corner diagonally opposite the ant. What is the length of the shortest...
The Infinite Chocolate Bar
A chocolate bar is cut into five pieces: a small square, a rectangle, two diagonal slope pieces, and a large base piece. We rearrange the pieces, reforming the...