KeithSchwarz.com Back | Forward

# The Magic Boxes

The Magic Boxes is an example of using binary numbers to express decimal numbers. That is, expressing numbers as sums of powers of two.

Any number can be expressed as the sum of powers of two. In fact, this principle is the reason that the binary number system works. The binary number system is also known as "base 2," and is the way that computers can perform complex arithmetic so simply. To explain how it works, we first will discover how our number system works. We as humans work in base 10. That means that each successive digit in a number is another power of 10. For example:

147
= 100 + 40 + 7
= (1 x 100) + (4 x 10) + (7 x 1)
= (1 x 10²) + (4 x 10) + (7 x 100)

54
= 50 + 4
= (5 x 10) + (4 x 1)
= (5 x 10) + (4 x 100)

9523
= 9000 + 500 + 20 + 3
= (9 x 1000) + (5 x 100) + (2 x 10) + (3 x 1)
= (9 x 10³) + (5 x 10²) + (2 x 10) + (3 x 100)

So what is binary? There is but one difference between our decimal system and the binary system. The binary number 10 represents our number 2.

Knowing this, it is rather simple to convert a binary number into a decimal number. Here are numerous examples.

11001
= 10000 + 1000 + 1
= (104) + (103) + (100)
[Remember that 10 represents 2, so:]
= (24) + (23) + (20)
= 16 + 8 + 1
= 25

111
= 100 + 10 + 1
= (102) + 10 + (100)
[10 = 2, so:]
= (22) + (21) + (20)
= 4 + 2 + 1
= 7

1011000
= 1000000 + 10000 + 1000
= (106) + (104) + (103)
[Again, 10 = 2]
= (26) + (24) + (23)
= 64 + 16 + 8
= 88

So how does this help explain the magic boxes? Simple. Here is the first Magic Box:

 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49

Here is that same box, but converted into binary.

 000001 000011 000101 000111 001001 001011 001101 001111 010001 010011 010101 010111 011001 011011 011101 011111 100001 100011 100101 100111 101001 101011 101101 101111 110001

Do you see the pattern? The last binary digit ("bit") of each number is 1.

Here's the second box:

 2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 34 35 38 39 42 43 46 47 50

And, of course, in binary:

 000010 000011 000110 000111 001010 001011 001110 001111 010010 010011 010110 010111 011010 011011 011110 011111 100010 100011 100110 100111 101010 101011 101110 101111 110010

Do you see the pattern here? The second-to-last bit of every number here is 1.

This pattern extends to every single Magic Box. In the first box, the last bit is always 1. In the second, the second-to-last. In the third, the third-to-last, etc.

So how can you tell what the chosen number is merely by knowing what boxes it's in? Merely take all these binary digits and recompose them back into a decimal number. This may seem difficult, but actually it's quite simple. Just add together the first number in every box, and the sum will be the chosen number.

For example, assume that the reader says that the number is the in the first, fourth, and fifth boxes. This means that the last bit, fourth-to-last bit, and fifth-to-last bit will all be 1. Here's the math to convert this to decimal:

11001
= 10000 + 1000 + 1
= (104) + (103) + (100)
= (24) + (23) + (20)
= 16 + 8 + 1
= 25

At first this may seem difficult, but with practice becomes almost second nature (especially if you're a computer scientist and happen to have your powers of two down cold).