genea
look and say
quines
rat
robump
self-similar
song history
string synth
stroids
tm interpreter
Unless otherwise stated, all original content on this site is licensed under your choice of the GNU FDL or the Creative Commons ShareAlike License.
Hopefully, this website is valid. You can check the XHTML, the CSS, and the RSS.
This is a fun, difficult puzzle. I like it because it has the feel of finite automata and randomized algorithms. I believe it originated in Hungary. Below is the statement of the problem. See also this variation.
The warden meets with 23 new prisoners when they arrive. 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 labeled A and B, 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 switch one and only one of the switches. 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. However, I will select the prisoners with equal probability.”
“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 (i.e., somebody has not yet visited the switch room), you will all be fed to the alligators.”
The puzzle is to figure out a strategy that the prisoners may employ to gain their freedom. In order to count as a solution, a strategy must be guaranteed to not result in the prisoners being fed to the alligators and it must almost surely set them free after a finite amount of time (that is, the probability that they will never be set free must be zero). Here are some solutions.