I start with the problem statement (excerpted from the Wikipedia).
A room contains a cupboard with 100 drawers. The director randomly puts one prisoner’s number in each closed drawer.
The prisoners enter the room, one after another. Each prisoner may open and look into 50 drawers in any order. The drawers are closed again afterwards.
If, during this search, every prisoner finds their number in one of the drawers, all prisoners are pardoned. If even one prisoner does not find their number, all prisoners die.
Before the first prisoner enters the room, the prisoners may discuss strategy — but may not communicate once the first prisoner enters to look in the drawers.
What is the prisoners’ best strategy?
Solution from the Wiki (spoiler alert)
The solution is provided in this wiki article about the 100 prisoners problem.
Link
The brilliant approach involves probability, integer partitions, and permutations of cycles within the integer partitions.My Specific Solutions
After reading the wiki solution above, I wanted to work through the problem by hand, step-by-step. Of course, the 100-prisoner hand solution, with , would be long and tedious; therefore, I started with the 4-prisoner problem with and I followed that with the 6-prisoner problem with .
See my calculation PDF here
Or here
The chance of success (all prisoners released), is as follows:
Referring to Page 5 of the PDF
For , the probability of success is
Referring to Page 6 of the PDF
For , the probability of success is
In summary
The probability of success for the prisoners is
where is a harmonic number.
My calculations verify the solution shown in the wikipedia.
, therefore:
It follows that:
For : checks ✓
Reference and Related Interest
Best of Seven Outcome Probability Dec 2020
Monty Hall — Consider Only Strategy Dec 2022
CodeSkulptor3 (Probability Plot) Aug 2020
Frank Morgan’s Math Chat — Ways to Make Change for a Dollar