The problem is this

There are 100 prisoners in solitary cells. There's a central living room with one light bulb; this bulb is initially off. No prisoner can see the light bulb from his or her own cell. Everyday, the warden picks a prisoner equally at random, and that prisoner visits the living room. While there, the prisoner can toggle the bulb if he or she wishes. Also, the prisoner has the option of asserting that all 100 prisoners have been to the living room by now. If this assertion is false, all 100 prisoners are shot. However, if it is indeed true, all prisoners are set free and inducted into MENSA, since the world could 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 in the courtyard, to discuss a plan. What plan should they agree on, so that eventually, someone will make a correct assertion?

A visitor to the CTK Exchange by the name of Kerry has posted a probabilistic approach whose validity was well supported by calculations.

Let y be the number of years.

One prisoner thinks 100 days between going to living room (on average) times 99 prisoners at least. 27 years to get out (law of averages.) It feels wrong. Something is really wrong.

Well he thought, what are the chances all the people have gone into the living room after a year, after 2 years etc...

The possibility all 100 people are chosen after a given number of years is:

100^{-365y}\sum_{k=0}^{100}{(-1)^k}{100 \choose k}(100-k)^{365y},

where 365y is the number of days, y is the years (it’s in there twice).

So he will make the claim sometime after 4-5 years. Some designated counter can count whatever lights he wants, but he will free all 100 thanks to the laws of probability. He saved them each over 20 years in jail. That’s over 2,000 man years.

Phew…. My chart

Even more precise, but not significant in the outcome is:

Where t is the number of times he has already been in the living room

Conditions

If t=0 then there is no chance what so ever. If 365y-t<99 no chance what so ever.

99^{-365y-t}{\sum_{k=0}^{99}{(-1)^k}{99 \choose k}(99-k)^{365y-t}}

Years

  1. 6.9011% or 14 in 15 of Mass Excecution
  2. 93.7616% or 1 in 600
  3. 99.8373% or 1 in 15.8
  4. 99.9958% or 1 in 23,500
  5. 99.9998% or 1 in 924,000
  6. 99.99999724% or 1 in 36.2 million
  7. 99.99999993% or 1 in 2.4 billion
  8. 99.999999999% or 1 in 55.6 billion
  9. 99.999999999... or 1 in 2.18 trillion
  10. 99.999999999... or 1 in 85.4 trillion (the people on 13,000 planets with equal populations to earth)

Any way I tested the math with a probability chart and 2, 3 and 4 prisoners and up to 10 days. It computes.

For my calculations I eventually settled on this. Assuming he is chosen about 3.65 times in each year.

\sum_{k=0}^{99}{(-1)^k}{99 \choose k}(99-k)^{361.6y}99^{-361.6y}