Are You Smarter than 100 Prisoners? This Riddle Stumped Me Until I Simulated It



Spoiler Alert: This Post Has Nothing to Do With AI

I took a day off to run some errands and get caught up on life. Later in the evening, I came across an interesting riddle video called the 100 prisoners riddle on Veritasium. I could not believe what Derek Muller was saying. Nor did I understand how the proposed strategy worked. For a minute I thought the video may have been recorded for April Fools' Day. When all else fails, we trust our Monte Carlo simulations.

The 100 prisoners problem is a fascinating probability puzzle where 100 prisoners must each find their own number in one of 100 drawers to survive. Each prisoner can open only 50 drawers, and they cannot communicate once the search begins. If all prisoners find their respective numbered boxes they will all be pardoned. Even if one person could not get his/her number they will all be executed. At first glance, the odds seem hopelessly low, with a survival probability of about 10−30 if they choose drawers randomly.

However, a clever strategy dramatically improves their chances. By following a specific sequence based on the numbers found, the prisoners can boost their survival probability to over 30%. This strategy, which I have referred to as the "looping strategy" is simply not palatable. I couldn't wrap my head around why the proposed "looping strategy" would work.



So I decided to run a Monte Carlo simulation to test whether the looping strategy actually improves the prisoners' outcomes. I implemented the simulation in Python, which you can view here: GitHub. Running the simulation multiple times demonstrated that the looping strategy does in fact give the prisoners a huge boost in their probability of success!

Seeing the simulation results helped me better understand how the prisoners' chances are dramatically improved by coordinating their efforts with the looping strategy. The distribution of wins from the Monte Carlo trials showed a weird distribution. Once I realized why the distribution was so odd, I started learning why the strategy worked.

In the end, taking some time off for personal matters led me down an unexpected path of logic puzzles and simulations. It was a nice change of pace from my day-to-day work and a fun learn by doing session.

Let me know if you find this quick diversion into recreational math and simulations interesting. I'm always happy to discuss techniques for simulating complex scenarios. Who knows - it may come in handy someday!

Support my work

Comments

Popular posts from this blog

Existential Risk from Super intelligent Machines

Advantage; Homeloan

Virus: Discussing macroscopic possibilities