Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 998 Bytes

README.md

File metadata and controls

20 lines (14 loc) · 998 Bytes

100-Prisoners-Riddle

This is the program written to prove the 100 Prisoners Riddle made by Veritasium.

First it calculates the probability of the prisoners winning on hundred attampts (to calculate the percentage),
then, I repeated it for 1000 times to calculate the average percentage of winning.

Output:

| ████████████████████████████████████████████████████████████████████████████████████████████████████  | 100 % done
Average number of times prisoners are freed: 30.026%

The value comes close to what was expected by Veritasium.

You can repeat the calculation any number of times to calculate precise average (by changing the times variable).
You can also change the number of prisoners.

Thank you for reading! Have a good day 😄