/100_Prisoners

100 prisoners riddle.

Primary LanguagePython

Veritasium published a video about the 100 prisoners riddle.
I could not stop thinking about it, so I gave it few tries and wrote a python script.
My conclusion: All prisoners are going to die every time!

This is the link to the video.
https://www.youtube.com/watch?v=iSNsgj1OCLA

It's been a while since I wrote code in python.
So I'm sure it could be done easier or better.


These are my results.

The lucky prisoner found his number within 50 tries!

Number of runs 100
Average number of lucky prisoners 37.73
Highest number of lucky prisoners 55
All Dead


Number of runs 1000
Average number of lucky prisoners 37.304
Highest number of lucky prisoners 60
All Dead


Number of runs 100000
Average number of lucky prisoners 37.50073
Highest number of lucky prisoners 69
again. All dead


Number of runs 1000000
Average number of lucky prisoners 37.496279
Highest number of lucky prisoners 68
again. All prisoners get executed