100 prisoners are put into solitary cells. There's a central living room with one light bulb; the bulb is initially off. No prisoner can see the light bulb from his or her own cell. Every day, the warden picks a prisoner at random, and that prisoner goes to the central living room. While there, the prisoner can toggle the bulb if he or she wishes. Also, the prisoner has the option of asserting the claim that all 100 prisoners have been to the living room. If this assertion is false (that is, some prisoners still haven't been to the living room), all 100 prisoners will be shot for their stupidity. However, if it is indeed true, all prisoners are set free and inducted into MENSA, since the world can always use more smart people. Thus, the assertion should only be made if the prisoner is 100% certain of its validity.
The prisoners are allowed to get together one night, to discuss a plan. What plan should they agree on, so that eventually, someone will make a correct assertion?
(From http://www.ocf.berkeley.edu/~wwu/riddles/intro.shtml)
I am rusty on my statistics, and I don't claim this to be a complete solution, but something about dividing the prisoners into two camps keeps pinging my brain...
Have the 100 will turn the light on once, while the other half will turn it off once.
What I can't figure out is determining a finished state, other than noticing the light has been static for X amount of time.. (Which is dangerous towards the last few switchers: Assume there is only one guy left, then there is a 1/100 chance that he/she will get picked, thus leaving the light stale for quite a while.)
Any ideas from this? Could a counter be introduced? (If so, do you have to worry about an equal number of 'turnon' vs 'turnoff' folks?)

Posted by Matt
on 20020828 05:35:39 