The Prisoner Game

A mathematical brain teaser I first heard about from the youTuber Veritasium.

The idea is that the sadistic warden of a prison comes up with a mental torture to inflict on his inmates: he gathers together 100 prisoners and tells them there is a way they can gain their freedom. Each prisoner, one at a time, will be allowed into a room where 100 folders are laid out on tables, numbered 1 to 100. The folders contain the same 100 numbers, but shuffled. For example, folder 1 might contain the number 86 and folder 86 might contain the number 5, and so on. Each prisoner will be allowed to look inside half of the folders, hoping to find his own number. If he finds his number in one of the 50 folders he is allowed to open, he "wins". Of course, if a prisoner is allowed to look at half the folders, he has a 50:50 chance of finding his own number and winning. However, there is a huge catch: all of the prisoners have to win in order for any of them to be freed. If even one fails, all 100 will be executed! This seems almost impossible — it would be like expecting to flip a coin 100 times and always get the same result.

As each prisoner takes his turn looking for his number, he will be carefully watched. He is not allowed to rearrange anything, or write any notes, or add or subtract or change anything in the room in any way. And when he leaves, he is isolated from prisoners still awaiting their turn. However, the prisoners are allowed to confer before the game starts, to come up with a strategy. And it turns out that there is a strategy which will greatly improve their odds of all finding their number. The odds of winning go from nearly zero, to about 30%.

Can you guess the strategy the prisoners should use?