Last March, on Pi Day (March 14, 2015), I put together a mathematical magic show for the Pi Day festivities at our local library, compiling various tricks that I teach to our future secondary teachers. I was expecting an audience of junior-high and high school students but ended up with an audience of elementary school students (and their parents). Still, I thought that this might be of general interest, and so I’ll present these tricks as well as the explanations for these tricks in this series. From start to finish, this mathematical magic show took me about 50-55 minutes to complete. None of the tricks in this routine are original to me; I learned each of these tricks from somebody else.

Think of a number from 0 to 63. Then, on your piece of paper, circle the cards that contain your number. For example, if your number is 15, you’ll need to circle the card in the upper-left because 15 is on that card. You’d have to circle all the cards that contain 15.

(pause)

Is everyone done? (Points to someone) Which cards did you circle?

At this point, the audience member will say something like “Top left, top middle, and bottom right.” Then I will add the smallest numbers on each card (in this case, 1, 2, and 32) and answer in five seconds or less, “Your number was 35 (or whatever the sum is).” It turns out that the number is always the sum of the smallest numbers on the selected cards.As shown in yesterday’s post, this is a consequence of the binary representation of whole numbers (as opposed to the ordinary decimal representation).

Though I don’t do this in my magic routine for the sake of time, I have challenged my future high school math teachers to develop a similar magic trick for some other base, like base 3, just to make sure that they really understand the concept behind the above magic trick. Here are the cards that work for base 3 (taken from http://www.mathman.biz/html/sherimagic.html).

I encourage the reader to develop another set of cards for base 5. It will require 10 cards for numbers from 1 to 24.

Last March, on Pi Day (March 14, 2015), I put together a mathematical magic show for the Pi Day festivities at our local library, compiling various tricks that I teach to our future secondary teachers. I was expecting an audience of junior-high and high school students but ended up with an audience of elementary school students (and their parents). Still, I thought that this might be of general interest, and so I’ll present these tricks as well as the explanations for these tricks in this series. From start to finish, this mathematical magic show took me about 50-55 minutes to complete. None of the tricks in this routine are original to me; I learned each of these tricks from somebody else.

Think of a number from 0 to 63. Then, on your piece of paper, circle the cards that contain your number. For example, if your number is 15, you’ll need to circle the card in the upper-left because 15 is on that card. You’d have to circle all the cards that contain 15.

(pause)

Is everyone done? (Points to someone) Which cards did you circle?

At this point, the audience member will say something like “Top left, top middle, and bottom right.” Then I will add the smallest numbers on each card (in this case, 1, 2, and 32) and answer in five seconds or less, “Your number was 35 (or whatever the sum is).” It turns out that the number is always the sum of the smallest numbers on the selected cards.

In yesterday’s post, I gave a similar but utterly unimpressive trick; the trick was unimpressive because it was obvious that the trick used our ordinary base-10 representation of whole numbers. The trick above is much more impressive because it uses binary (base-2) instead of base-10.

The cards above are carefully rigged using binary arithmetic, so that all numbers are written as sums of powers of 2. For example, on the card in the upper left, the first few numbers are

,

and so on. On the right-hand side, I’ve written each number as the sum of powers of 2 (for the numbers at hand, that means 1, 2, 4, 8, 16, and 32). Notice that each expansion on the right hand side contains a 1. So, if the audience member tells me that her number is on the upper-left card, that tells me that there’s a 1 in the binary representation of her number.

Let’s now take a look at the first few number in the upper-middle card:

,

and so on. Notice that each expansion on the right hand side contains a 2. So, if the audience member tells me that her number is on the upper-middle card, that tells me that there’s a 2 in the binary representation of her number.

Similarly, the upper-right card has numbers which contain 4 in its binary representation. The lower-left card has numbers containing 8. The lower-middle card has numbers containing 16. And the lower-right card has numbers containing 32. Happily for the magician, each of these numbers is also the smallest number on the card.

So, if the audience member will says “Top left, top middle, and bottom right,” then I know that the binary representation of her number contains 1, 2, and 32. Adding up those numbers, therefore, gives me the original number!

After explaining how the trick works, I’ll call up an audience member to play the magician and repeat the trick that I just performed. Then I’ll move on to the next magic trick in the routine.

A friend of mine posted the following on Facebook (with names redacted):

So [my daughter] comes home with this assignment:

For each number from 10 – 99, carry out the following process.

If the number is a palindrome (e.g., 77), stop.

Else reverse the number and add that to the original. E.g.: 45+54 = 99.

If the result is not a palindrome, repeat step (2) with the result.

Record the final palindromic result and the number of steps taken.

Most are simple.

56 + 65 = 110

110 + 011 = 121

Stop. 2 steps taken.

The numbers 89 and 98 were given for extra credit, and they mysteriously explode, taking 24 steps. It made [my daughter] cry.

She wanted me to check her work, so I decided it was a good time to teach the wonders of Python, and we very quickly had a couple of simple functions to do the trick.

Well, you saw where this was going. How many steps does 887 take?

We’re up to 104000 steps so far, and Python is crying.

True or false: For a given n, the above algorithm completes in finite time?

I guess I’ve been living under a rock for the past 20 years, because I had never heard of this problem before. It turns out that numbers not known to lead to a palindrome are called Lychrel numbers. However, no number in base-10 has been proven to be a Lychrel number. The first few candidate Lychrel numbers (i.e., numbers that have not been proven to not be Lychrel numbers) are 196, 295, 394, 493, 592, 689, 691, 788, 790, 879, 887, 978, 986, 1495, 1497, 1585, 1587, 1675, 1677, 1765, 1767, 1855, 1857, 1945, 1947, 1997, 2494, 2496, 2584, 2586, 2674, 2676, 2764, 2766, 2854, 2856, 2944, 2946, 2996, 3493, 3495, 3583, 3585, 3673, 3675…

The above algorithm is called the 196-algorithm, after the smallest suspected Lychrel number.

For further reading, I suggest the following links and the references therein:

Every so often, I’ll informally teach a class of gifted elementary-school students. I greatly enjoy interacting with them, and I especially enjoy the questions they pose. Often these children pose questions that no one else will think about, and answering these questions requires a surprisingly depth of mathematical knowledge.

Here’s a question I once received:

Suppose

If the pattern goes on, and if , what is ?

In yesterday’s post, we found that the answer was

,

a number with approximately digits.

How can we express this number in scientific notation? We need to actually compute the integer and decimal parts of , and most calculators are not capable of making this computation.

Fortunately, Mathematica is able to do this. We find that

Here’s the Mathematica syntax to justify this calculation. In Mathematica, means natural logarithm:

Again, just how big is this number? As discussed yesterday, it would take about 12.14 quadrillion sheets of paper to print out all of the digits of this number, assuming that was printed in a microscopic font that uses 100,000 characters per line and 100,000 lines per page. Since 250 sheets of paper is about an inch thick, the volume of the 12.14 quadrillion sheets of paper would be

By comparison, assuming that the Earth is a sphere with radius 4000 miles, the surface area of the world is

.

Dividing, all of this paper would cover the entire world with a layer of paper about inches thick, or about 35 sheets deep. In other words, the whole planet would look something like the top of my desk.

What if we didn’t want to print out the answer but just store the answer in a computer’s memory? When written in binary, the number requires…

bits of memory, or…

about bits of memory, or…

about $latex 5.04 \times 10^{25} bytes of memory, or …

about terabytes of memory, or…

about 50.4 trillion terabytes of memory.

Suppose that this information is stored on 3-terabyte external hard drives, so that about trillion of them are required. The factory specs say that each hard drive measures . So the total volume of the hard drives would be , or .

By way of comparison, the most voluminous building in the world, the Boeing Everett Factory (used for making airplanes), has a volume of only . So it would take about 1136 of these buildings to hold all of the necessary hard drives.

The cost of all of these hard drives, at $100 each, would be about $1.680 quadrillion. So it’d be considerably cheaper to print this out on paper, which would be about one-seventh the price at $242 trillion.

Of course, a lot of this storage space would be quite repetitive since , in binary, would be a one followed by zeroes.

How high can you count on two hands? The answer is 1023, if you use binary. I made the following video to demonstrate this to my students.

True story: This is a trick that I came up with when I was 10 years old. As is common in classrooms, my teacher had had enough disruptions in class, and told us students to put our heads on our desks in silence for 15 or 20 minutes as punishment. Naturally, I was trying to think of something to do to pass the time, and I somehow came up with the idea that I could keep myself entertained by counting in binary using my fingers.

When I was a kid, I could count to 1023 in about 5 minutes. But I was a lot more dextrous then, and so it takes me about 6 or 7 minutes today.

In the previous post, I verified that the above infinite series actually converges to :

Still, a curious student may wonder how one earth one could directly convert into binary without knowing the above series ahead of time.

This can be addressed by using the principles that we’ve gleaned in this study of decimal representations, except translating this work into the language of base . In the following, I will use the subscripts and so that I’m clear about when I’m using decimal and binary, respectively.