Letters and Words

Some letters and words about physics and maths

Christmas Cracker Calculator

by

in

On Christmas day we sat round the table, crossed our arms, and pulled crackers on each side. In mine, I found a silver paper hat, a terrible joke, and a sparkly orange bobble (that I will be keeping). My sister had won the real jackpot; nestled inside her cracker was the magic of modern computing. 

She had won a ‘magic calculator’: six pieces of card with seemingly random numbers listed in no particular order on them. A set of instructions explained how to wow your audience with a magic trick:

  1. Ask the audience to pick a number on any of the six pieces of card without showing it to you. 
  2. They should then pick out all the cards which have this number present and give them back to you.
  3. You will then secretly add up all the numbers in the top left corner of these cards.
  4. Finally, reveal to your audience their number!
The ‘Mystery Calculator’ on Maths Ed Ideas

I did the trick a couple of times and my family were surprisingly impressed. One of them chimed in “how does it work?”

My first thought was this: after a quick look at the cards, every number from one to sixty-three is listed somewhere. For the trick to work, each number must be the sum of the top left numbers of some combination of the six cards. In other words, there must be at least sixty-three unique ways of choosing a subset of the cards. Can there really be that many ways of combining these cards?

If there were only three cards, there would only be seven ways of choosing a subset of the cards. Three ways of picking just one card, three different ways of picking two cards (you can think of this as three ways of choosing which card to leave out), and one way to pick all three of the cards. 

So how about when there’s six cards? 

There are six ways of picking one card.

For two cards it already gets a bit more complicated. Let’s think through it one step at a time. When we pick our first card there are six cards to choose from. When we pick our second card there are now five cards to choose from. Naively we might think this means there are 6×5=306 \times 5 = 30 ways of choosing two of the six cards. For each of the six paths we can go down initially, it branches into a further five paths. But by this reasoning, if we pick card A followed by card B, this will be considered a unique combination to picking card B followed by card A. In this game, the order that we choose the cards in is completely irrelevant, so we want to get rid of this overcounting. For two cards, every combination can be written in two ways (A then B or B then A), so we simply divide by two. That means we have fifteen ways of uniquely choosing two cards.

Now we have a rough procedure, we can use it for every number of cards. 

Three cards: 6×5×4=1206\times 5\times 4=120 ways of picking three cards. But this overcounts the 3×2=63\times 2=6 different ways of ordering the three cards we pick. So there are in fact 1206=20\frac{120}{6} =20 ways of uniquely choosing three cards. 

Four cards: 6×5×4×3=3606\times5\times4\times3=360 ways of choosing. 4×3×2=244\times3\times2=24 ways of ordering each combination. 36024=15\frac{360}{24}=15 ways of uniquely choosing four cards. 

Five cards: 6×5×4×3×25×4×3×2=6\frac{6\times5\times4\times3\times2}{5\times4\times3\times2}=6 ways of uniquely choosing five cards.

Six cards: Clearly there is only one unique way of choosing all six cards.

Our grand total is 6+15+20+15+6+1=636+15+20+15+6+1=63 ways of choosing a unique subset of the cards – the exact number we needed! 

So we know we have enough combinations of the cards so that each number can be associated with a unique combination. But what about all this summing the numbers in the left corner business? Why should that always work out to give the number we want? My Dad made the observation first: “Sixty-three is 2612^6 -1. Is that important?” We looked more closely at the cards; in the top left corners were the numbers 1,2,4,8,16,321, 2, 4, 8, 16, 32. Also known as 20,21,22,23,24,252^0, 2^1, 2^2, 2^3, 2^4, 2^5. It was there all along – binary. 

We write our numbers using a decimal system. We have unique symbols from zero through to nine, then we write the next number as 1010. The 11 represents one set of 10110^1 and the 00 represents zero sets of 10010^0. A more illustrative example: the number three-hundred and seventy-four. When we write the digits 3,7,43, 7, 4, in this way, what we really mean is three lots of 10210^2 plus seven lots of 10110^1 and four lots of 10010^0. You may get a sense here that there are other ways we can write numbers. We’ve chosen our system to revolve around powers of ten. Why not powers of six? Or eleven? Or one-hundred and forty thousand three hundred and ninety nine? One of the most revolutionary questions, however, was why not powers of two? 

The last digit represents how many sets of 202^0, the previous digit sets of 212^1, before that sets of 222^2, and so on… To count from one to ten we can write:

1,10,11,100,101,110,111,1000,1001,10101, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010

And that is the beauty of binary – we can write every number with just ones and zeroes. This is how computers work; millions, billions or even trillions of tiny switches that can either be on (representing one) or off (representing zero). We might think in decimal, but computers think in binary. And that doesn’t exclude our magic Christmas cracker calculator either! Each card carries a different power of two and can either be on (included in the combination given back to the magician) or off (excluded from the combination). By the law of binary, if we can have up to six digits, each of which can be zero or one, we can make every single number from one to sixty-three.

And there we have it, our magic calculator is actually a computer using binary to spread a little Christmas cheer. 


Leave a comment