The Locker Riddle

Your rich and weird uncle has just passed away. You and 99 of your filthy relatives are also invited to read his will. It was your uncle’s intention to leave the entire estate to you, but he knew that in such a case, his relatives would not give you rest. Will you be able to solve the puzzle he left and take the legacy he left behind? Lisa Winer explains.

Transcript:

Your rich, eccentric uncle just passed away, and you and your 99 nasty relatives have been invited to the reading of his will. He wanted to leave all of his money to you, but he knew that your relatives would pester you forever if he did. So he is banking on the fact that he taught you everything you need to know about riddles. Your uncle left the following note in his will: “I have created a puzzle. If all 100 of you answer it together, you will share the money evenly. However, if you are the first to find the pattern and solve the problem without going through all of the leg work, you will get the entire inheritance all to yourself. Good luck.”

The lawyer takes you and your 99 relatives to a secret room in the mansion that contains 100 lockers, each hiding a single word. He explains: Every relative is assigned a number from 1 to 100. Heir 1 will open every locker. Heir 2 will then close every second locker. Heir 3 will change the status of every third locker, specifically, if it’s open, she’ll close it, but if it’s closed, she’ll open it. This pattern will continue until all 100 of you have gone. The words in the lockers that remain open at the end will help you crack the code for the safe.

Before cousin Thaddeus can start down the line, you step forward and tell the lawyer you know which lockers will remain open. But how?

The key is realizing that the number of times a locker is touched is the same as the number of factors in the locker number. For example, in locker #6, Person 1 will open it, Person 2 will close it, Person 3 will open it, and Person 6 will close it. The numbers 1, 2, 3, and 6 are the factors of 6. So when a locker has an even number of factors, it will remain closed, and when it has an odd number of factors, it will remain open. Most lockers have an even number of factors, which makes sense because factors naturally pair up.

The only lockers with an odd number of factors are perfect squares because those have one factor that equals the number when multiplied by itself. For Locker 9, 1 will open it, three will close, and nine will open it. 3 x 3 = 9, but the three can only be counted once. Therefore, every locker that is a perfect square will remain open. You know that these ten lockers are the solution, so you open them immediately and read the words inside: “The code is the first five lockers touched only twice.” You realize that the only lockers touched twice have to be prime numbers since each only has two factors: 1 and itself.

So the code is 2-3-5-7-11. The lawyer brings you to the safe, and you claim your inheritance. Too bad your relatives were always too busy being nasty to each other to pay attention to your eccentric uncle’s riddles.

Ali Kaya

This is Ali. Bespectacled and mustachioed father, math blogger, and soccer player. I also do consult for global math and science startups.