would have thought to develop a number system based on ten. Instead, we would have considered it normal and natural and sensible and inevitable and incontrovertible and undeniably proper to base our number system on eight.
We wouldn't call this a decimal number system. We'd call it an octal number system, or base eight. If our number system were organized around eight rather than ten, we wouldn't need the symbol that looks like this:
9
Show this symbol to any cartoon character and you'll get the response, "What's that? What's it for?" And if you think about it a moment, we also wouldn't need the symbol that looks like this:
8
In the decimal number system, there's no special symbol for ten, so in the octal number system there's no special symbol for eight. The way we count in the decimal number system is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and then 10. The way we count in the octal number system is 0, 1, 2, 3, 4, 5, 6, 7, and then what? We've run out of symbols. The only thing that makes sense is 10, and that's correct. In octal, the next number after 7 is 10. But this 10 doesn't mean the number of fingers that humans have. In octal, 10 refers to the number of fingers that cartoon characters have
When you're working with number systems other than decimal, you can avoid some confusion if you pronounce a number like 10 as one zero. Similarly, 13 is pronounced one three and 20 is pronounced two zero. To really avoid confusion, we can say two zero base eight or two zero octal.
Even though we've run out of fingers and toes, we can still continue counting in octal. It's basically the same as counting in decimal except that we skip every number that has an 8 or a 9 in it. And of course, the actual numbers refer to different quantities:
0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22,
23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 40, 41, 42, 43,
44, 45, 46, 47, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, 63, 64,
65, 66, 67, 70, 71, 72, 73, 74, 75, 76, 77, 100…
That last number is pronounced one zero zero. It's the number of fingers that cartoon characters have, multiplied by itself. When writing decimal and octal numbers, we can avoid confusion and denote which is which by using a subscript to indicate the numbering system. The subscript TEN means base ten or decimal, and EIGHT means base eight or octal.
Thus, the number of dwarfs that Snow White meets is 7TEN or 7EIGHT
The number of fingers that cartoon characters have is 8TEN or 10EIGHT
The number of symphonies that Beethoven wrote is 9TEN or 11EIGHT
The number of fingers that humans have is 10TEN or 12EIGHT
The number of months in a year is 12TEN or 14EIGHT
The number of days in a fortnight is 14TEN or 16EIGHT
The "sweet" birthday celebration is 16TEN or 20EIGHT
The number of hours in a day is 24TEN or 30EIGHT
The number of letters in the Latin alphabet is 26TEN or 32EIGHT
The number of fluid ounces in a quart is 32TEN or 40EIGHT
The number of cards in a deck is 52TEN or 64EIGHT
The number of squares on a chessboard is 64TEN or 100EIGHT
The most famous address on Sunset Strip is 77TEN or 115EIGHT
The number of yards in an American football field is 100TEN or 144EIGHT
The number of starting women singles players at Wimbledon is 128TEN or 200EIGHT
The number of square miles in Memphis is 256TEN or 400EIGHT
Notice that there are a few nice round octal numbers in this list, such as 100EIGHT and 200EIGHT and 400EIGHT . By the term nice round number we usually mean a number that has some zeros at the end. Two zeros on the end of a decimal number means that the number is a multiple of 100TEN, which is 10TEN times 10TEN. With octal numbers, two zeros on the end means that the number is a multiple of 100EIGHT , which is 10EIGHT times 10EIGHT (or 8TEN times 8TEN, which is 64TEN).
You might also notice that these nice round octal numbers 100EIGHT and 200EIGHT and 400EIGHT have the decimal equivalents 64TEN, 128TEN, and 256TEN, all of which are powers of two. This makes sense. The number 400EIGHT (for example) is 4EIGHT times 10EIGHT times 10EIGHT , all of which are powers of two. And anytime we multiply a power of two by a power of two, we get another power of two.
The following table shows some powers of two with the decimal and octal representations:
The nice round numbers in the rightmost column are a hint that number systems other than decimal might help in working with binary codes.The octal system isn't different from the decimal system in any structural way.
It just differs in details. For example, each position in an octal number is a digit that's multiplied by a power of eight:
If you work out this calculation in decimal, you'll get 2005TEN. This is how you can convert octal numbers to decimal numbers.
We can add and multiply octal numbers the same way we add and multiply decimal numbers. The only real difference is that we use different tables for adding and multiplying the individual digits. Here's the addition table for octal numbers:
Octal is as valid a number system as decimal. But let's go further. Now that we've developed a numbering system for cartoon characters, let's develop something that's appropriate for lobsters. Lobsters don't have fingers exactly, but they do have pincers at the ends of their two front legs. An appropriate number system for lobsters is the quaternary system, or base four
Let's say we have the binary number 101101011010. This can be written as
Let's take a look at this list of binary numbers for a moment. Consider each of the four vertical columns of zeros and ones, and notice how the digits alternate going down the column:
The rightmost digit alternates between 0 and 1.
The next digit from the right alternates between two 0s and two 1s.
The next digit alternates between four 0s and four 1s.
The next digit alternates between eight 0s and eight 1s.
This is very methodical, wouldn't you say? Indeed, you can easily write the next sixteen binary numbers by just repeating the first sixteen and putting a 1 in front:
Here's another way of looking at it: When you count in binary, the rightmost digit (also called the least significant digit), alternates between 0 and 1. Every time it changes from a 1 to a 0, the digit second to right (that is, the next most significant digit) also changes, either from 0 to 1 or from 1 to 0.
So every time a binary digit changes from a 1 to a 0, the next most significant digit also changes, either from a 0 to a 1 or from a 1 to a 0.
When we're writing large decimal numbers, we use commas every three places so that we can more easily know what the number means at a glance. For example, if you see 12000000, you probably have to count digits, but if you see 12,000,000, you know that means twelve million.
Binary numbers can get very long very quickly. For example, twelve million in binary is 101101110001101100000000. To make this a little more readable, it's customary to separate every four binary digits with a dash, for example 1011-0111-0001-1011-0000-0000 or with spaces: 1011 0111 0001 1011 0000 0000. Later on in this book, we'll look at a more concise way of expressing binary numbers.
By reducing our number system to just the binary digits 0 and 1, we've gone as far as we can go. We can't get any simpler. Moreover, the binary number system bridges the gap between arithmetic and electricity. In previous chapters, we've been looking at switches and wires and lightbulbs and relays, and any of these objects can represent the binary digits 0 and 1:
A wire can be a binary digit. If current is flowing through the wire, the binary digit is 1. If not, the binary digit is 0.
A switch can be a binary digit. If the switch is on, or closed, the binary digit is 1. If the switch is off, or open, the binary digit is 0
A lightbulb can be a binary digit. If the lightbulb is lit, the binary digit is 1. If the lightbulb is not lit, the binary digit is 0.
A telegraph relay can be a binary digit. If the relay is closed, the binary digit is 1. If the relay is at rest, the binary digit is 0.
Binary numbers have a whole lot to do with computers.
Sometime around 1948, the American mathematician John Wilder Tukey (born 1915) realized that the words binary digit were likely to assume a much greater importance in the years ahead as computers became more prevalent. He decided to coin a new, shorter word to replace the unwieldy five syllables of binary digit. He considered bigit and binit but settled instead on the short, simple, elegant, and perfectly lovely word bit.