Note: Read this problem carefully, because it's completely different from the original.
As
before, 100 prisoners are put into solitary cells, and there's a room with a light bulb. (No prisoner can see the light bulb from his or her own cell.) Every night, the warden picks a prisoner at random, and that prisoner goes to the living room. While there, the prisoner can toggle the bulb if he or she wishes. but this time, the prisoner needs to assert that he knows, which prisoner was in the living room before him. If the assertion is false, all 100 prisoners will be shot. However, if it is indeed true, all prisoners are set free. 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.
But, the prisoners know that after that night, when they will go back to their solitary cells. the warden will choose one prisoner secretly (and this time, not randomly) and will kill him.
What plan should they agree on, so that eventually, someone will make a correct assertion?
The posted solution (and any other solution mentioned so far) has only a 1/100 chance on any given day that the prisoners will be released.
However, if the selection is truly random, we can improve on this. One way: Just wait until somebody goes in two days in a row! On any given day, the prisoner selected will have been selected yesterday with probability 1/99.
Even better, this can be combined with one of the mod n schemes discussed previously, to exactly double the chances of being released on any given night. Probability on any given night is (1/99) + (1/100) - (1/99)(1/100) = 198/9900 = 1/50. Expected release time is halved!
Curiously enough, this can even be combined with the mod 1 scheme. Prisoner 1 always turns the light on, nobody else ever does, and we are released if prisoner 1 goes into the cell or if anybody else goes in two nights in a row. This plan has an expected success rate of 2% per night (slightly higher if prisoner 1 is not executed and a lot lower in the unlikely case that prisoner 1 is executed). Even if prisoner 1 is executed, we are guaranteed that the prisoners will eventually be freed.