Ah, the things nerds do when they're bored. About 5 years ago, I went on a two week long backpacking trip in New Mexico with some friends. This wasn't New Mexico like you might be envisioning; these were mountains, 7000 feet high from base to peak. Each day we'd get up before dawn, pack our gear, lace up our boots, and then hike ten miles over said mountains until early afternoon when the day started heating up.
We usually ended up being on the trail only about six hours which left us another six to eight hours before sunset with nothing do. A group of 8 teenage boys with matches, knives, rope, and far too much time on our hands: what were we to do? Mental math of course!
Between discussions of movies, video games, and girls, we discovered (it was much more miraculous than a simple invention) the Base Game. Here's how you play: One person starts off by yelling out a number--"1206 in Base 3!"--and then we'd race to convert it. The first person to get the right answer won, got a point and got to yell out the next number. The person with the most points at the end of the game won. A wrong answer meant negative points.
But why should our discovery die in New Mexico? This is a pastime that should, nay, must be enjoyed by all! Play it at family reunions, play it at parties, play it as a drinking game, play it by yourself. But first, some tips on the fastest way to convert and understand numbers in different bases.
So what are bases after all? The simplest explanation is that a base is the number of symbols per place value in that system. The base number is always one larger than the value of the highest symbol because one of the symbols must always be a placeholder. For example, base 10 has ten different symbols: 0-9. The highest value that can be represented by a single digit is 9; one less than the base number. Likewise, base 2 (or binary) has two symbols--1 and 0--and the largest single-digit number is one less than the base: 1.
Knowing this, you may wonder what place value actually is. Place value is the concept that the same symbol can have two different values depending on where it is located. Number systems that use place value are called positional number systems. As an example, in our own base 10 positional number system the symbol 9 can represent 9 ones, 9 tens, 9 hundreds etc. depending on where it is located.
To see the difference, consider the most familiar system without place value: Roman numerals. Roman numerals did not have place value, they had symbolic value: a X was a X whether it came at the beginning or the end. What that means is that the number each numeral represented depended on what the symbol was (I=1, X=10, C=100) not where the symbol was located. Numbers that did not have their own symbol were represented by arithmetic combinations of those numerals so 9 would be IX (X minus I) or VIIII(V plus IIII).
How did zero become a number?
Now for a short history lesson. The Greeks and Romans had the concept of a placeholder but never gave it a symbolic representation. They would instead write the word "nothing". First Alexander the Great and then the Roman legion conquered parts of Asia, creating a knowledge exchange in the near east. When Europe fell to the dark ages, this knowledge was preserved and expanded upon by the Byzantines, Arabs, and Persians. As early as the Moorish invasion of the Iberian Peninsula in the early 8th century and continuing with the crusades and the beginnings of exploration by Marco Polo, knowledge began to flow back to the West where it had stagnated several centuries before. This back flow is the reason why we have the word algebra and the currently used Arabic numerals.
One of the concepts brought back to Europe was a numeric symbol (instead of a word) used to represent nothing: zero. Medieval scholars just didn't grok this concept at all. "If the symbol 0 represents nothing," they reasoned, "why have it at all?" The answer is that the symbol 0 is also a place holder. On its own, it carries no information but when put next to another number, it shows what place value that number has. This is because it 'holds the place' of a number in a place of lower value. Before the concept of 0, the number one hundred one would be written 1 1 and the number eleven written as 11. The only thing differentiating the numbers was the space in between the ones for one hundred one. When written quickly or inexactly, this could easily become confusing. The symbol 0 replaced the spaces between numbers of different place value. With the zero, it becomes easy to understand that 101 and 11 are not the same value.
The Good, the Bad, and the Ugly
So, what does all this have to do with converting from one base to another? First, let's break down the familiar base 10 system so we can really understand it:
|100,000| 10,000| 1,000 | 100 | 10 | 1 |
| - | - | 1 | 0 | 2 | 4 |
In this table, all the place values are labeled. As you can see, the number 1024 is represented by a 1 in the thousands place, 0 in the hundreds place, 2 in the tens place, and 4 in the ones place. The 0 is holding the place of a number in the hundreds place, showing that the 1 is in the thousands place while still denoting nothing in the hundreds place.
Each of the places has a value equal to a power of the base. So the place values in base 10 are 100, 101, 102, 103, etc. Those powers translate into the ones, tens, hundreds, and thousands places we're familiar with. The same pattern goes for numbers in different bases. In binary--or base 2--the places are 20, 21, 22, 23--ones, twos, fours, and eights place.
To convert a number from base 10 to another base you simply keep on dividing it by the base number while marking down the remainder. Divide once, then take the remainder and put it in the ones places. Next you divide the result, and put the remainder in the next place. Keep on doing this until you no longer have a remainder. If the number divides evenly, put a 0 down as a placeholder and divide again.
Let's apply this to an example: converting 1024 base 10 into base 7.
|(75)16,807 | (74)2,401 | (73)343 | (72)49 | (71)7 | (70)1 |
| - | - | 2 | 6 | 6 | 2 |
First, take 1024 and divide it by 7. Make sure to keep track of the remainder; that's the number that goes in the ones place. So, 1024/7=146 remainder 2. That means that we have 146 sevens and 2 ones. However, we can't have 146 sevens because it's larger than our largest value symbol which is 6. Because of this, we divide 146 by seven. This is the same as grouping our groups of 7 into groups of 7--the same as grouping them into 49s. We get 20 remainder 6, so put the 6 down in the 7s place and divide again. 20/7 is 2 remainder 6 so put the 6 in the 49s place and divide one last time. 2/7 is 0 remainder 2 so put the 2 in the 343s place. If you look back at the place value and add up all the numbers, you'll find that it's equal to 1024 base 10.
Why Base 1 Doesn't Work
Base one doesn't work because it does not have enough digits to have a placeholder symbol. The role of the 1 digit in base 1 is to indicate the presence of value in that place. Because of the way exponents work, all the places have the same value: one.
| (15)1 | (14)1 | (13)1 | (12)1 | (11)1 | (10)1 |
| - | / | / | / | / | / |