The Logician’s Rave Riddle

YouTube video

Once a year, thousands of logicians descend into the desert for Learning Man. At the center of that gathering is the world’s most exclusive club, where under the full moon the annual logician’s rave takes place. The entry is guarded by the Demon of Reason, and the only way in is to solve one of his dastardly challenges. Can you get into the rave? Edwin Meyer shows how.


Once each year, thousands of logicians descend into the desert for Learning Man, a week-long event they attend to share their ideas, think through challenging problems, and mostly to party. And at the center of that gathering is the world’s most exclusive club, where the annual logician’s rave takes place under the full moon. The Demon of Reason guards the entry, and the only way to get in is to solve one of his dastardly challenges.

You’re attending with 23 of your closest logician friends, but you got lost on the way to the rave and arrived late. They’re already inside, so you must face down the demon alone. He poses you the following question:

When your friends arrived, the demon put masks on their faces and forbade them from communicating in any way. No one could see their masks at any point, but they stood in a circle where they could see everyone else’s. The demon told the logicians that he distributed the masks so that each person would eventually be able to figure out their mask’s color using logic alone. Then, once every two minutes, he rang a bell. At that point, anyone who could come to him and tell him the color of their mask would be admitted.

Here’s what happened: Four logicians got in at the first bell. Some number of logicians, all in red masks, got in at the second bell. Nobody got in when the third bell rang. Logicians wearing at least two different colors got in at the fourth bell. All 23 of your friends played the game perfectly logically and eventually got inside. Your challenge, the demon explains, is to tell him how many people gained entry when the fifth bell rang.

Can you get into the rave?

It’s initially difficult to imagine how anyone could deduce their mask color using logic and the colors they see on the other masks. But even before the first bell, everyone will realize something critical. Let’s imagine a single logician with a silver mask. When she looks around, she’d see multiple colors but no silver. So she couldn’t ever know that silver is an option, making it impossible for her to deduce that she must be silver logically. That contradicts rule five, so there must be at least two masks of each color.

Now, let’s think about what happens when there are precisely two people wearing the same color mask. Each of them sees only one mask of that color. But because they already know that it can’t be the only one, they immediately know that their mask is the other. This must be what happened before the first bell: two pairs of logicians each realized their mask colors when they saw a unique color in the room.

What happens if three people are wearing the same color? Each of the—A, B, and C— sees two people with that color. From A’s perspective, B and C would be expected to behave the same way the orange and purple pairs did, leaving at the first bell. When that doesn’t happen, each of the three realizes that they are the third person with that color, and all three leave at the next bell. That was what the people with red masks did— so there must have been three of them. We’ve now established a basis for inductive reasoning. Induction is where we can solve the simplest case, then find a pattern that will allow the same reasoning to apply to successively larger sets. The pattern here is that everyone will know what group they’re in as soon as the previously sized group has the opportunity to leave.

After the second bell, there were 16 people. No one left on the third bell, so everyone then knew there weren’t any groups of four. Multiple groups, which must have been of five, left on the fourth bell. Three groups would leave a solitary mask wearer, which isn’t possible, so it must’ve been two groups. And that leaves six logicians outside when the fifth bell rings: the answer to the demon’s riddle. Nothing left to do but join your friends and dance.

Ali Kaya


Ali Kaya

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

Similar Videos

Binary Counter | Video | Abakcus

Binary Counter

Are you looking for a stunning math project idea to showcase binary numbers? Then, here is a beautiful mechanical binary counter for you! With its intricate design, this counter provides…