## One Hundred Lockers

I found this riddle online. It’s a bit math oriented, but still relatively easy for non-math geeks to solve đ

Lockers in a row are numbered 1 , 2 , 3 , . . . , 100. At first, all the lockersÂ are opened. A person goes and closes every locker.Â Next, another person walks by and opens every other locker, starting with locker #2.Â Thus lockers 2 , 4 , 6 , . . . , 98 , 100 are open. Another person walks by and “toggles” every third locker (ie closes a locker if it is open, opens a locker if it is closed), starting with locker #3. Then another person toggles everyÂ fourth locker, starting with #4, etc… This process continues until no more lockers canÂ be altered.

Question: At the end of all the toggling, which lockers will be closed?

## Ice Cream for Three Boys

I just realized that I haven’t posted a riddle in over a year so here’s another one…Credits to Jeremy for sharing this riddle:

Three boys, Ken, Kevin, and Kyle, are promised ice cream by the self-proclaimed God of the universe, Khanh, but with a challenge attached. Khanh randomly puts a blue or red hat on each of Ken, Kevin and Kyle. Each boy can see the hats of the other two boys, but not his own hat. Their goal is to guess the colour of their own hat, but they have only one chance to guess. Khanh counts down from 3 out loud and on “1”, the boys must either shout out the colour they think their hat is or keep quiet and not say anything. If any of the boys guesses the colour of his hat incorrectly OR none of the boys says anything, none of them gets ice cream. However as long as at least one person guesses his hat’s colour right and no one else guesses it wrong, then they all get ice cream.

Any form of communication as soon as the first hat is put on, until they make their guesses, is completely forbidden by Khanh. If the boys try to communicate, Khanh will find out and the they won’t get ice cream.

Question: Granted the boys have time to discuss a strategy beforehand, what strategy can they come up with to maximize the chances of getting ice cream? With this strategy, what are the odds that they will get ice cream?

## Riddle – Prisoners and Hats

My grade twelve calculus teacher asked our class this five years ago. I like this riddle a lot because of the elegance and simplicity of its solution đ :

A sadistic prison guard plays a game with 10 of his prisoners. He has the prisoners all line up facing one way so the one at the front of the line is #1 and the one at the back is #10.

After lining them up, the guard then places either a red hat or a blue hat on top of each prisoner. The prisoners can’t see their own hat colour, but can see the hats of all prisoners in front of them (ie #10 can see the hats of the 9 people in front of him, #8 can only see the 7 hats in front of him etc…). The guard then goes up to #10 and asks what colour his hat is. #10 can respond only either âredâ or âblueâ. If he is wrong, the guard will shoot him; otherwise, heâs free. Regardless, the prisoner then proceeds to #9 and asks the same thing, then to #8, etc.

Once a prisoner announces either “red” or “blue” all the other prisoners will hear it although they won’t know the fate of that one prisoner. Also assume all the prisoners have good memory so they will remember what each of the previous prisoners said (ie #8 will remember what #9 and #10 said, #7 will remember what #8,9 and 10 said etc…).

Before this game, the prisoners are allowed some time to discuss their strategy before lining up. What should their strategy be so they can guarantee to save the most lives?

Here’s an example of one possible strategy: *Prisoner #10 says the colour of #9’s hat. Then #9 says that same colour he heard so he’ll live. The process is repeated with #8 saying #7’s hat colour, #6 saying #5’s hat colour etc…* This will guarantee 5 lives, but isn’t the optimal strategy and you can do a lot better.

**For those who solved the riddle, please don’t post the solution in the comments so other people can still have a chance to solve it.**