# Think of a Number. How Do Math Magicians Know What It Is?

Science

###### Insights puzzle

Mathematical magic can seem like mind reading. Your job is to reveal the secret behind these four tricks.

James Round for Quanta Magazine

Math has a certain logic to it. If you use it to accurately describe a situation, sometimes you can predict the inevitable — for instance, the moment an eclipse will take place — centuries in advance. To those unfamiliar with the math behind the prediction, this outcome might seem like magic. Indeed, the science fiction author Arthur C. Clarke famously wrote, “Any sufficiently advanced technology is indistinguishable from magic.”

In today’s Insights puzzle we’ll explore four examples of mathematical magic that can seem, at first glance, like mind reading. Just like stage magic, these examples can leave you wondering, “How did they know that?”

Many of us have experienced this as children. We are asked by a friend to think of a certain number without revealing it. We are then asked to do a series of simple arithmetical operations on it. Finally, our friend astonishes us by telling us our secret number. So how is this done?

Here’s a simple example that might astonish a child in your life and even inspire a fascination with math. It was used for this purpose by Lewis Carroll, the author of *Alice’s Adventures in Wonderland*. Carroll was an Oxford mathematician and avid puzzler, whose math puzzles have entertained many mathematicians, including the famous Terence Tao.

## Science **Puzzle 1**

This magic trick is designed for a child who can do multiplication reliably (get an assistant to help them if not). Ask your own little Alice (or Bob) to think of a three-digit number without telling you what it is. Then tell them that you will reveal the number by producing two copies of it side by side! First ask the child to multiply their number by 7. Then ask them to multiply the answer by 11. Finally — and at this point you can add feigned concentration and appropriate magical phrases — ask them to multiply the second answer by 13.

If the child has done this right, you might find a smile start to light up their face. The question for you, or for an older child, is — why does this work?

If you’re interested in more Lewis Carroll math puzzles, you can find them here. Now let’s get into something a little harder.

## Science **Puzzle 2**

There are two unknown numbers between 2 and 9. The two numbers can include 2 or 9 and they can both be the same number. S and P are two mathematicians with perfect logic. S is given only the sum of the two numbers, and P is given only the product. Both S and P know everything we’ve just specified. Here is their subsequent conversation.

*S: I cannot deduce what the two numbers are.*

*P: Neither can I.*

*S: Aha! Now I know what the two numbers are!*

*P: So do I!*

This seems like magical mind reading at first glance — where could they be getting the new information to solve the problem? Can you figure out the two numbers (there are two possible answers). Can you explain how S and P did this?

Hint: Tabulate all the information that S and P have at every point, figuring out what they can infer. Remember to consider all possible cases. This doesn’t involve any difficult calculations, but it’s easy to get confused about what each of them knows.

Now for a harder version that has many more possibilities.

## Science **Puzzle 3**

Again, there are two unknown numbers that could be equal, but now they are between 2 and 50. Again S is given only the sum of the two numbers, and P is given only the product. Here’s how their conversation goes this time.

*P: I cannot deduce what the two numbers are.*

*S: I could have told you that, even though I can’t deduce the numbers either.*

*P: Aha! Now I know what the two numbers are!*

*S: So do I!*

Again, find the two numbers and explain how P and S did this.

In puzzle 2, you had 15 unique sums with 64 products. In this one you have 97 unique sums with 2,804 products. Tabulation on paper was good enough for puzzle 2, but what now? You can, of course, use a spreadsheet or write a computer algorithm as some readers will no doubt try. But if you pay careful attention to the conversation, especially S’s first remark, you can significantly limit the possibilities by applying some elementary number theory, and yes, you can still solve the problem on paper. So our second question is: Using number theory principles, what’s the smallest number of cases (sums and products) that you have to examine manually after judicious exclusion?

Our next problem shows how to read minds in a card trick. But this trick is strictly mathematical and has some interesting mathematics underlying it.

## Science **Puzzle 4**

A “mathemagician” prepares a deck of 32 cards by throwing away the 2s through 6s. She arranges the remaining cards in a certain order and then places the deck, face down, on a table. Five people are randomly selected to go to the table. Each of them cuts the deck, one after another. Then the first person takes the top card and passes the deck to the second person, who takes the current top card, and so on, in order. Once each one has a card, the last person puts the deck back on the table face down, and they all return to their seats.

Now the performer asks the five people to beam her their card telepathically. A frown of concentration crosses her face. Finally she shakes her head in a resigned manner. “It’s getting harder these days,” she says. “The expansion of the universe is causing a redshift that’s interfering with the colors I am receiving. Will the people who have red cards please stand up?”

The second and fifth participants stand up. A relieved look crosses the mathemagician’s face. “Now it’s clear,” she says. “You have the 10 of hearts, and you have the king of diamonds.” They do, indeed. She proceeds to correctly guess the cards of the other three people as well.

How did she do it? Well, since I told you the trick is strictly mathematical, it’s clear that she memorized the card order (probably using some sort of code), and the card order somehow survived the five random cuts. Can you think of a way this might be done? Hint: Consider the sequence 00010111. It contains, cyclically, all eight possible triplets formed from zero and 1: 000, 001, 010, 101, 011, 111, 110 and 100. What happens if you “cut” it, as you would a card deck?

Was the performer’s stage banter mere theater, or was it essential to the trick?

Can you come up with a card-order code that’s easy to remember (for when you perform this trick)?

That’s it for today. I hope you were impressed with how math and logic can help you infer so much from so little information. Now, that’s magical!

Have fun unraveling how all these tricks were done.

*Editor’s note: The reader who submits the most interesting, creative or insightful solution (as judged by the columnist) in the comments section will receive a* Quanta Magazine *T-shirt** or one of the two *Quanta* books, *Alice and Bob Meet the Wall of Fire* or *The Prime Number Conspiracy* (winner’s choice). And if you’d like to suggest a favorite puzzle for a future Insights column, submit it as a comment below, clearly marked “NEW PUZZLE SUGGESTION.” (It will not appear online, so solutions to the puzzle above should be submitted separately.)*