I personally believe that a basic, if not strong, understanding of the binary (or base 2) counting is crucial to understanding how computers work. And, thus, to being a good programmer.
Counting in base 10
Before going into binary we should take a moment to think about something that should be completely natural. I'm speaking of how you count and do some simple math in base 10 or decimal counting.
Numbers in base 10 are simply the numerals 0-9. If you have a single digit you can only count to 9, thats 1 less than you can actually count on your fingers (assuming you don't have any extras)!
If you want to count beyond 9 you need to have more digits. Every digit you add on the left, you can count roughly 10 times as high as you could before. (e.g. 99 vs 9, 999 vs 99)
How high could you count using your fingers and your toes? (assuming the dexterity)
Well the answer isn't 20, but if you've been paying attention... 99 shouldn't surprise you. Here is how...
You start off counting normally on your hands up to 9, then your hands go back to 0, and you stick up a single toe. (I don't think I can physically do this, but you get the idea) You repeat this process putting up the second toe when you go from 19-20, and just keep going until 99.
You might be wondering, "hey I've got a finger and a toe that I'm not counting with, shouldn't I be able to count higher than 99?" Why yes, if you want to use base 11, you could count to 120 (11^2 - 1)but thats beyond the scope of this discussion and not natural to most people at all.
Counting in base 2
Base 2 only has the numerals 0 and 1. With a single digit you can only count to 1, thats it. To count higher you need to add another digit. But that only lets you count to 3, which isn't much better. How far can we count with 4 digits of binary?
| Decimal | Binary |
| 01 | 0001 |
| 02 | 0010 |
| 03 | 0011 |
| 04 | 0100 |
| 05 | 0101 |
| 06 | 0110 |
| 07 | 0111 |
| 08 | 1000 |
| 09 | 1001 |
| 10 | 1010 |
| 11 | 1011 |
| 12 | 1100 |
| 13 | 1101 |
| 14 | 1110 |
| 15 | 1111 |
(for now I'm going to put b behind every number that is explicitly binary.)
Phew I bet you didn't read the whole thing so I'm not sure why I bothered typing it all out. The pattern is pretty obvious. Just like when you get to, say, 100 in decimal and start counting up the lower 99 again. When you get to say 1000b you get to count up the lower three digits in exactly the same way.
How high can you count on your fingers and toes using binary?
1048575 Surprised? (1048575 = 1111 1111 1111 1111 1111b a 20 'bit' number)
If we used 4 fingers, the above chart gets us to 15
5 fingers? 31
10 fingers? 1023
You can see just how fast this is growing. The relationship is (base^numOfDigits -1)
2^5 = 32, 32-1 = 31
2^10 = 1024, 1024-1 = 1023
2^20 - 1 = 1048575
I couldn't make it, though I've never tried. Counting on a single hand from 0 to 15 or 31 is not too much of a challenge and I encourage you to try it.
Why don't we learn to count on our fingers in binary then?
The fact is that binary counting on fingers is more efficient because we can represent a single digit LITERALLY with a single digit (finger). Working with written binary numbers is more cumbersome, to count over 100 takes 6 binary digits!
Additionally, we are not digital processors. We can generally handle more data than a simple YES/NO or 1/0. Binary numbers are very verbose when compared to our 0-9 counting system, which makes binary more error prone, and more time consuming to work with.
Continue on with Understanding Binary: Math...
Post your comment
Comments
-
AFOhnsM
Posted by 3 month payday loans, 20/05/2012 3:26am (4 hours ago)
-
JYHzAwf
Posted by instant loans, 18/05/2012 11:07am (2 days ago)
-
gQtIjed
Posted by loans online, 16/05/2012 5:30pm (4 days ago)
-
mNDeghwdvn, <a href=http://paydayloanssonline.com>payday advance</a> ,23654, <a href=http://paydayloanssonline.com>online payday loans</a> ,3824, http://paydayloanssonline.com payday loan, 33870,
Posted by payday advance loans 63564, 12/05/2012 6:26am (8 days ago)
-
UBozTqbegnSrjilB, http://quickcashadvanceloanss.com cash advance ,<>x, <a href=http://quickcashadvanceloanss.com>cash advance loans</a> ,VkiuXvAEapeU, http://quickcashadvanceloanss.com quick cash loans, 93052,
Posted by quick cash loans 86753, 11/05/2012 2:12am (9 days ago)
RSS feed for comments on this page | RSS feed for all comments