Riddle Answer: Prisoner Counting Switches

One prisoner is designated as the counter. Anytime the switch on the right side is down, he flips it back up and increments his count. Otherwise, he just flips the switch on the left. 

Meanwhile, everyone else will also flip up the switch on the right when it is down, but only if they have done so less than twice. Otherwise, they flip the left switch.

This way, the counter can be sure that every prisoner has entered the room once his count reaches 40.

(Note: We need everyone to flip the switch twice (instead of once) to avoid the problem of an extra count when the counter first enters the room. He might be the first person into the room and the right switch might originally be down. If that happens with the double count, he will only reach 39 until the last person goes. Thus, he can be sure that at 40 everyone has gone. However, with a single count, he would reach 20, even before the last person went. So, "wait until 21" you might say. That would not work in the case where he was not the first person into the room. The strategy must ALWAYS work."

No comments:

Post a Comment