Counting to 1023 on 10 fingers
Created | Updated Jul 8, 2003
I learned Binary Finger Counting from programmer extraordinaire/good friend Jim Reneau who pointed out to me that if caveman had only known binary, he could have counted 1023 animals instead of limiting himself to a mere 10 using 10 fingers. But first, an introduction to binary:
BINARY INTRODUCTION: (for the graphical version, goto http://www.dnaco.net/~ivanjs/binprime.html)
By: John Selvia
Binary is the language of computers. Everything you type, input, output, send, retrieve, draw, paint, or place blame on when something doesn't work is, in the end, converted to the computer's native language- binary. But just how does this whole "on/off", "1/0", "hi/lo" thing work?
Binary is called a Base 2 numbering system (the "bi" in the word binary was a dead giveaway). Base 2 allows us to represent numbers from our Base 10 system (called the decimal system - "dec" meaning 10) using only 2 digits - 1 and 0 - in various combinations.
Example of a typical binary number: 10001010
which translates into our decimal system as 138.
To the computer, binary digits aren't really 1s and 0s. They're actually electrical impulses in either a (mostly) on state or a (mostly) off state. Just like a switch - either on or off. Since you only have 2 possible switch combinations or electrical possibilities, the computer only needs various combinations of 2 digits to represent numbers, letters, pixels, etc. These 2 digits, for our sake are visually represented by 1s and 0s.
Bits, Bytes and Words
Binary numbers can be from 1 digit to infinity. But for our uses, there aren't too many numbers that we can't live without that can't be represented by 32-bit or 64-bit binary numbers. Let's start with the basics.
A single binary 1 or a single binary 0 is called a bit, which is short for "binary digit". A single bit by itself isn't of much use to the casual user, but can do wonders in the hands of a programmer working at the system level.
Take 4 of these bits and slap them together and they now form what's called a nibble (though this term isn't used very often). A nibble can represent the decimal values 0 to 15 (16 distinct values).
Take 8 bits and put them together and you have one of the mostly commonly used computer terms in existence - the byte. A single byte can represent the decimal values 0 to 255 (256 distinct values) and since every possible character you can type on an English keyboard is represented by a number less than 128 to the computer (called ASCII codes) , a single letter of the alphabet takes 1 byte to represent internally (technically, you can represent all the letters of the alphabet using only 7-bits of a byte, but we won't get into that). When we speak of how much ram a computer has, we say it has 256-megabytes of ram, meaning 256 million bytes (most people nowadays just say 256 megs of ram and leave off the byte word).
Place a couple of bytes together to represent a single value and you have a 16-bit word (2 bytes = 16-bits). A 16-bit word can represent the values 0 to 65535 (65536 distinct values). In the old days 16-bit words were used to form the addresses of 8-bit computers such as the Commodore 64, the Atari 800, and the Apple IIs, to name a few. These 16-bit words which were big enough to store an address for a 64k computer consisted of 2 bytes, a high byte and a low byte.
32-bit words are 4 bytes in length. They can represent a value from 0 to 4,294,967,295 (4,294,967,296 distinct values). Pretty big number, but bigger still is the 64-bit word, which is, for you math-deprived people, 8 bytes in length (8 bytes times 8 bits per byte). This whopping monstrosity can represent a number from 0 to 1.844 E+19 if I understand my calculator correctly.
Okay, enough about bits, bytes and words. Let's figure out how to read a lowly 8-bit binary number.
HOW TO READ A BINARY NUMBER:
As stated previously, a byte consists of 8 bits, each bit having the possible value of either a 1 or a 0. Now when deciphering binary numbers, don't think of the 1 or 0 as an actual value itself, but a flag to determine whether it has any importance in the calculation of the final result. Lost? Let's look at an example:
Example binary number: 10001010
Binary representation of decimal 138.
Any time you're going to interpret a binary number, set something up on a piece of paper that looks like this-
http://www.dnaco.net/~ivanjs/images/binexamp.gif
Now, look at those numbers above the boxes with the red 1s and 0s. Those are decimal numbers representing powers of 2. Starting from the left and going to the right they are 2 to the 7th power (2^7), 2 to the 6th power (2^6), 2 to the 5th power (2^5), 2 to the 4th power (2^4), 2 to the 3rd power (2^3), 2 to the 2nd power (2^2), 2 to the 1st power (2^1) and 2 to the 0th power (2^0):
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
It just so happens that with powers of 2, each successive number is double the one before it. In other words if 2^0 is equal to 1 then 2^1 = 2 and 2^2 = 4 and 2^3 = 8 and so on. Here are the values of the powers of 2 going from 2^7 down to 2^0:
128 64 32 16 8 4 2 1
These are the values that are above the boxes. Now the actual binary number itself consists of 1s and 0s in the blue boxes which somehow magically represents the decimal number 138. How do we get 138 from 10001010? In the binary number when you see a 1, multiply that 1 times the value that is directly over it. Where you see a 0 in the box, just ignore it. So looking at our graphic again,
http://www.dnaco.net/~ivanjs/images/binexamp.gif
we see that there is a 1 under the 128, a 1 under the 8, and a 1 under the 2. If we add only those numbers which have a binary 1 in the box under them, we come up with 128+8+2 which equals 138.
Here's another example:
http://www.dnaco.net/~ivanjs/images/binexam2.gif
Thus, binary 11100110 is equal to 128+64+32+4+2 which is decimal 230
And another one:
http://www.dnaco.net/~ivanjs/images/binexam3.gif
Thus, binary 10000001 is equal to 128+1 which is decimal 129.
Hope this makes more sense than when you started.
__________________________________________________________________________________
HOW ABOUT THAT BINARY FINGER COUNTING?
To count in binary on your fingers, you've got to think of each of your fingers as a binary digit. If a finger is up, it is a binary 1. If it is down, it is a binary 0. All fingers down equals 0 and all fingers up (on 1 hand) equals 31.
To get started, hold you right hand up in front of you with the palm facing you. Hold up all 5 fingers. The thumb is equal to 1. In binary, each finger to the left of the previous finger has double the value of that previous finger. Huh? Look at this:
http://www.dnaco.net/~ivanjs/images/binall.gif
Notice that the thumb is 1. To the left of the thumb (from my point of view as demonstrator), the forefinger is double the thumb, so the forefinger is 2. The middle finger is double the forefinger, so it is equal to 4. The ring finger is double the middle finger, so it is equal to 8. And finally, the pinky (little finger to some) is equal to 16 which is double the ring finger's value.
The way you count in binary on your fingers is to start with the thumb up and nothing else. The thumb by itself, having the value of 1, equals 1 (amazing, that).
Now since the forefinger, being to the left of the thumb in this position is double the thumb, the forefinger must be 2, since the thumb is 1 and 1 doubled is 2. So drop the thumb and let the forefinger come up. You are now looking at a binary 2.
Since the middle finger is 4, how on earth do you get the next number, which is 3? You add the 2 finger to the 1 finger (thumb, actually). So now, the forefinger and the thumb should both be up to equal 3 (2+1).
To get the 4, drop the 2 and 1 fingers, and raise the middle finger (but not in public!!!). Yes, binary 4 creates quite an amusement for some people (or anger depending on the situation).
To get a 5, keep the 4 finger up and raise the thumb, since 4 + 1=5. See a pattern developing here? Everytime you want to add 1, raise the thumb! What could be easier? Here's the first 7 numbers in binary using your fingers:
http://www.dnaco.net/~ivanjs/images/binary1-7.gif
And here's the 8-13 numbers:
http://www.dnaco.net/~ivanjs/images/binary8-13.gif
And the rest thru 31...
http://www.dnaco.net/~ivanjs/images/binary14-19.gif
http://www.dnaco.net/~ivanjs/images/binary20-25.gif
http://www.dnaco.net/~ivanjs/images/binary26-31.gif
If you want to show 1023 in binary, you would write 1111111111 (512+256+128+64+32+16+8+4+2+1). To show that on your fingers, hold both hands up so that the pinky of the left hand is next to the pinky of the right hand and have all 10 fingers up, like this:
http://www.dnaco.net/~ivanjs/images/1023.gif
So with both hands facing you, the pinky on the left hand is 32, the ring finger of the left hand is 64, the middle finger of the left hand is 128, the forefinger of the left hand is 256 and the thumb on the left hand would be 512, like this:
http://www.dnaco.net/~ivanjs/images/1023label.gif
If you want to display 257 in binary, you would write 0100000001 which is 256+1, so in binary finger counting, you'd hold up the forefinger of the left hand (256) and the thumb of the right hand (1), so 256+1=257. Like this:
http://www.dnaco.net/~ivanjs/images/257.gif
The number 449 in binary is 0111000001 and in binary finger counting, it would look like this:
http://www.dnaco.net/~ivanjs/images/449.gif
This is is the end of the tutorial.
To really see this pattern working, check out the shockwave version of binary finger counting that I did:
http://www.dnaco.net/~ivanjs/BINARY_FINGER_SW.html
John Selvia
GALLERY: http://homepage.mac.com/johnselvia/
THOUGHTS: http://www.dnaco.net/~ivanjs/