"The 100 prisoners problem is a mathematical problem in probability theory and combinatorics. In this problem, 100 numbered prisoners must find their own numbers in one of 100 drawers in order to survive. The rules state that each prisoner may open only 50 drawers and cannot communicate with other prisoners. At first glance, the situation appears hopeless, but a clever strategy offers the prisoners a realistic chance of survival." (Source: Wikipedia)
For more information read the full article: 100 prisoners problem
This video describes it very well: Video
I wanted to take a closer look at this problem and to retrace the solution approach. The solution is very interessting. This code is used to model the problem. In addition, the solution is implemented and the probability of success can be calculated.
Have fun trying it out yourself.
- numpy (pip install numpy)