Nautilus Members enjoy an ad-free experience. or Join now .

You have to cleverly build “common knowledge” to solve this lethal riddle.Wikicommons

You’ve been caught snooping around a spooky graveyard with your best friend. The caretaker, a bored old man fond of riddles (and not so fond of trespassers), imprisons each of you in a different room inside the storage shed, and, taking your phones, says, “Only your mind can set you free.” To you, he gestures toward a barred window. Through it, you can see 12 statues. Out of your friend’s window, which overlooks the opposite side of the graveyard, she can see eight. Neither of you know the other’s count.

Nautilus Members enjoy an ad-free experience. Log in or Join now .

The caretaker tells you each, individually, that together you can see either 18 or 20 statues. Unfortunately, there’s no way to tell your friend how many you can spot. The only way for you both to escape is for one of you to give the total number of visible statues. Get it wrong, and neither of you ever leave. The caretaker asks you each one at a time, once a day, and you can choose to answer or to pass. Both of you know that you’re always asked first.* If you both pass on a given day, the question—are there 18 or 20?—is posed to each of you again the next day, and the next, and so on, until you get it right or wrong. The caretaker cackles, “If you need me, I’ll be out preparing your graves.”

How do you escape?

Nautilus Members enjoy an ad-free experience. Log in or Join now .

If you want to puzzle through it yourself, don’t read on. The solution follows.

Photograph by Jussi-Teppo Toivonen / Flickr

Presh Talwalkar, author of The Joy of Game Theory: An Introduction to Strategic Thinking, fleshed out the solution to the problem last year, on his blog “Mind Your Decisions.” The puzzle was posted with no attribution on a forum hosted by the Stanford engineer and Quantitative Engineering Design co-founder William Wu, by a user who had only heard of the riddle in Swedish. It originally featured an evil king and trees in a castle’s courtyard, but is presented here in a more modern scenario.

To survive the encounter with the crazy caretaker, he may have to feed you, unless you were both captured on very full stomachs. That’s because, in the worst case, it will require five days of detainment to decamp. Why?

Nautilus Members enjoy an ad-free experience. Log in or Join now .

First, you and your friend have to realize that each “pass” counts as a signal. Given that you haven’t had time to consult with each other before being separated, this will require some degree of intelligence—and confidence in each other. And second, it will require five days of signalling to deduce the number of statues with certainty. In game theoretic terms, this establishes the needed “common knowledge” to escape. Many logic riddles rely on this concept, like “Blue Eyes,” described on the website xkcd.com—how can you figure out your eye color if other people won’t tell you and you can’t see your reflection? The social scientist Simon DeDeo describes another logic puzzle whose solution relies on building common knowledge in his Nautilus article “The Bitcoin Paradox.”

Day 1

If you saw 19 or 20 statues, then you could conclude there are 20 statues. But you only see 12, so you pass. This signals to your friend that you see at most 18 statues.

If your friend saw 0 or 1 statues, knowing that you see at most 18, she could conclude there would have to be 18 statues. But your friend sees 8, so passes. This signals to you that she sees at least 2 statues.

Nautilus Members enjoy an ad-free experience. Log in or Join now .

Day 2

If you saw 17 or 18 statues, then you could conclude there are 20 because your friend must see at least 2 statues. But you only see 12, so you pass. This signals to your friend that you see at most 16 statues.

Now if your friend saw 2 or 3 statues, knowing that you see at most 16, she could conclude there would have to be 18 statues. But your friend sees 8 statues, so she has to pass. This signals to you that she sees at least 4 statues.

Day 3

Nautilus Members enjoy an ad-free experience. Log in or Join now .

If you saw 15 or 16 statues, then you could conclude there are 20 because your friend must see at least four statues. But you only see 12, so you pass. This signals to your friend that you see at most 14 statues.

Now if your friend saw four or five statues, knowing that you see at most 14 statues, she could conclude there would have to be 18 statues. But she sees eight statues, so she has to pass again. This signals to you that your friend sees at least six statues.

Day 4

If you saw 13 or 14 statues, then you could conclude there are 20 because your friend must see at least six statues. But you only see 12, so you pass. This signals to your friend that you see at most 12 statues.

Nautilus Members enjoy an ad-free experience. Log in or Join now .

Now if your friend saw six or seven statues, knowing that you see at most 12 statues, she could conclude there would have to be 18 statues. But your friend sees eight statues, so she has to pass again. This signals to you that she sees at least eight statues.

Day 5

Since your friend sees at least eight statues, and you see 12, you know there are 20. You guess 20 and get freed!

Brian Gallagher is the editor of Facts So Romantic, the Nautilus blog. Follow him on Twitter @brianga11agher.

Nautilus Members enjoy an ad-free experience. Log in or Join now .

* This post was edited to clarify that the question is not posed simultaneously, and that both prisoners know who’s asked first.

WATCH: How to define intelligence in terms of the Rubik’s Cube.

close-icon Enjoy unlimited Nautilus articles, ad-free, for as little as $4.92/month. Join now

! There is not an active subscription associated with that email address.

Join to continue reading.

Access unlimited ad-free articles, including this one, by becoming a Nautilus member. Enjoy bonus content, exclusive products and events, and more — all while supporting independent journalism.