# Cam's Blog

## January 1, 2010

### A simple parlor trick

Filed under: Elementary, Math — cfranc @ 6:52 pm

Happy New Year everybody! This afternoon my folks treated me and my brothers to a delicious roast beef dinner, complete with party crackers and dessert. My Dad’s cracker contained a “magic trick” involving some very simple math, which I’ll explain now. Unfortunately the trick involves several cards with numbers written on them as props, so if you’d like to pull this trick on somebody then you’ll need to make the cards yourself. The five cards contained the following lists of numbers and were otherwise blank:

Card 1:
1, 3, 5, 7, 9, 11, 13, 15,
17, 19, 21, 23, 25, 27, 29, 31

Card 2:
2, 3, 6, 7, 10, 11, 14, 15,
18, 19, 22, 23, 26, 27, 30, 31

Card 3:
4, 5, 6, 7, 12, 13, 14, 15,
20, 21, 22, 23, 28, 29, 30, 31

Card 4:
8, 9, 10, 11, 12, 13, 14, 15,
24, 25, 26, 27, 28, 29, 30, 31

Card 5:
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31

Note that there is no need to label the cards as Card 1, Card 2, etc.

Here are the instructions for the trick: shuffle the cards and let your victim choose one at random. They should then choose one of the numbers appearing on the chosen card and keep it secret. Now hand them all five cards and ask them to return only those cards which contain the secret number. Once you have received those cards back, then add up the top left numbers of the cards you have. The sum is the secret number.

For example, suppose my victim selected Card 3 above and picked the number 13. Then they would hand me Cards 1, 3 and 4 back. The top left entries of these are 1, 4 and 8, respectively, which sum to 13.

It’s not that difficult to figure out how this trick works. I urge you to think about it a bit before reading the explanation below. If you’d like a small hint then read this backwards: yranib ni kniht. The full explanation appears below the dots.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

Explanation: the numbers appearing on the cards are 1 through 31, which are precisely those nonzero positive integers whose binary expansion has at most five digits. Which of these numbers appear on each card? Card 1 contains all odd numbers between 1 and 31. This is the same as saying that the binary expansion of each number on Card 1 has a rightmost digit equal to 1. You can check that the numbers appearing on Card 2 are those between 1 and 31 such that their second binary digit is 1. Similarly Card 3 contains those whose third binary digit is 1, and so on. Thus, when your victim hands you all the cards containing the secret number, you have determined the binary expansion of the secret number uniquely. Since the powers of two appear as the top left entries of the cards, you can conveniently discover the secret number simply by adding these top left entries. Simple but cute.