# Locker Problem

**Discrete Mathematics**Level 5

In a prision there are 2n prisoners, 2n lockers and 2n hats. The prisoners, the lockers and the hats, each of them have a distinct number in the range of (1,2n) and every prisoner is aware of that and is able to identify his own number and the number of any locket or hat by looking at it.

They are gathered one time in a grand hall and are told that their 2n hats are randomly distributed over all the 2n lockets, so that in every locket lies a hat.
They are then told, that one after another is allowed to visit exactly n lockets and look at the hat, that is inside.
Then, if the prisoner is able to correctly guess the safe his hat is hidden in, then he is allowed leave the prison. If he guesses wrong, his soul enters the state of being no longer well defined, a gruesome fate indeed.

After a prisoners has become either free or not well defined, the next prisoner is given the exact same choice.
Before this game of freedom and non well definedness begins, the prisoners are allowed to come up with a plan to maximize their chances that all of them become free.

After the start of the game the prisoners are no longer able to communicate or exchange information between each other.

What is the best chance, the likelihood L of all prisoners escaping the prison successfully?

For the problem, one can assume, that the n becomes big, really really big. For the answer, type in \(\lfloor 1000*L \rfloor - 1 \)

As a hint: 0 is not the answer of the problem, even if the n goes to infinity...