Answer this week's riddle incorrectly, and your life – and the lives of 22 others – will be forfeit.

Sunday Puzzle #5: 23 Prisoners, 2 Switches

A warden meets with 23 newly arrived prisoners. He tells them, "You may meet today and plan a strategy. But after today, you will be in isolated cells and will have no communication with one another.

"In the prison is a switch room, which contains two light switches, each of which can be in either the on or the off position. I am not telling you their present positions. The switches are not connected to anything.

"After today, from time to time whenever I feel so inclined, I will select one prisoner at random and escort him to the switch room. This prisoner will select one of the two switches and reverse its position. He must move one, but only one of the switches. He can't move both, but he can't move none, either. Then he'll be led back to his cell.

"No one else will enter the switch room until I lead the next prisoner there, and he'll be instructed to do the same thing. I'm going to choose prisoners at random. I may choose the same guy three times in a row, or I may jump around and come back.

Advertisement

"But, given enough time, everyone will eventually visit the switch room as many times as everyone else. At any time anyone of you may declare to me, 'We have all visited the switch room.'

"If it is true, then you will all be set free. If it is false, and somebody has not yet visited the switch room, you will all be executed."

What strategy do the prisoners devise?

This is another classic puzzle, but one worth revisiting even if you've heard it before. (If you have heard it, and remember the solution, I suggest checking out this version). Five or six of you recommended this puzzle, or a variation of it, this week, so thanks to all of you who did – but thanks to David, in particular, for being the first to do so. We'll be back next week with the solution – and a new puzzle! Got a great brainteaser, original or otherwise, that you'd like to see featured? E-mail me with your recommendations. (Be sure to include "Sunday Puzzle" in the subject line.)

SOLUTION to Sunday Puzzle #4: The Logician's Children

Last week, I asked you to deduce the ages of a logician's children. Many of you posted the correct answer, but the first to describe it in detail was bewareofgeek, who, based on the first clue, realized that factorizing the number 36 would be essential to solving the riddle:

OK, let's play with this. As far as I can tell, the triplet factors for 36 are:

1 * 2 * 18

1 * 3 * 12

1 * 4 * 9

1 * 6 * 6

2 * 2 * 9

2 * 3 * 6

3 * 3 * 4

1 * 1 * 36

[Ed. Note: bewareofgeek forgot 1 * 1 * 36. This does not affect the outcome, but I've included it in bold for the sake of completeness.]

Advertisement

The second clue tells us that the sum of the children's ages is important. So bewareofgeek added up his factors:

And their sums are:

1 + 2 + 18 = 21

1 + 3 + 12 = 16

1 + 4 + 9 =14

1 + 6 + 6 = 13

2 + 2 + 9 = 13

2 + 3 + 6 = 11

3 + 3 + 4 = 10

1 + 1 + 36 = 38

At this point, something about the sums stands out: All but two of them are unique. If the two logicians had shared an apartment numbered 21, 16, 14, 11, or 10, then the guessing logician would have all the information he needs to guess the ages of his friend's children. The fact that he requires a third hint tells us the two logicians lived in Apartment #13 – the only non-unique sum:

1 + 6 + 6 = 13

2 + 2 + 9 = 13

"The third clue tells us which factorization is accurate," writes bewareofgeek, i.e. the factorization that allows for an unambiguously eldest child. The children's ages are therefore 9, 2, and 2.