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?
(In reply to An impractical solution...
Yes, it's impractical. The expected time to completion is 100/99 + 100 + 100/98 + 100 + 100/97 + 100 + ... + 100/1 + 100 days = about 28.5 years. This is the average time; the actual time could easily be twice this.
Unfortunately, if one of the prisoners dies in the interval, all bets are off, and the algorithm can't be completed if the dead guy hasn't flipped the switch yet.
Given the realities of the situation, I would probably just wait a specific number of days, then make the assertion. The following table shows how long to wait:
99% probability: 916 days
98% probability: 847 days
97% probability: 806 days
96% probability: 777 days
95% probability: 754 days
I think that any rational person would give up a 1% chance of death in exchange for getting out of prison 26 years earlier. (Especially when you consider that the 28 year plan fails if anyone dies.)
Posted by Jim Lyon
on 2002-08-27 09:03:29