Home » Technology

There are 10 types of people in this world …

Written By: Tom on April 26, 2009 5 Comments

It’s an old joke, but funny if you’re a dork like me:

There are 10 types of people in this world.  Those who understand binary and those who don’t.

Let’s talk about numbering systems.  Specifically Decimal (base10), Hexadecimal (base16) and Binary (base2).

First off, what is this base stuff that you’re talking about.  The base number in a numbering system is the number of values represented by a single digit.

Decimal – Base 10

This is the numbering system that everyone should know.  Each digit can have up to 10 values 0,1,2,3,4,5,6,7,8,9.  You might be saying “Wait a minute! Why is it called base 10 if its highest number for a digit is 9?” I’d say, fantastic question! Here’s the secret: nothing is really something. For each additional digit added in a number, you increase the total number of values that you can represent by a factor of 10. That is:

1 digit  (0 to 9) = 10 values =  10 = 10^1

2 digits (00 to 99) = 100 values = 10 x 10 = 10^2

3 digits (000 to 999) = 1000 values = 10 x 10 x 10 = 10^3

Now, don’t get freaked out when I say 3 digits can be 000 to 999 because 000 is the same as 0 is the same as 0^3. Just don’t confuse it with 0^0 which would be 1 (I already told you, nothing is really something).

So, if you take the base of your numbering system (10 in this case) and take it to the power of the number of digits you’re using, you’ll get the total number of values you can represent with that number.  Note: the highest number you can represent is 1 less than the total number of values you could represent because nothing is really something!

Example math:

 1  (overflow aka carry the 1)
  9
+ 1
---
 10

Hexadecimal – Base 16

I’ve included hexadecimal in this discussion simply because it’s cool and you’ll find it in a lot of places on the web.  A single digit can represent up to 16 different values 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. That’s right, you just got your alphabet in my numbers and I just got my numbers in your alphabet! In this notation, A = 10, B = 11, and so forth up to F = 15. A lot of times, when you see a number that is represented in hex (the short name for hexadecimal) they might tip you off by placing a 0x before the value.  This is important BECAUSE once we get into multiple digits, a hex number without any letters looks just like a decimal number, but its value totally different!

1 digit (0 to F) = 16 values = 16 = 16^1

2 digits (00 to FF) = 256 values = 16 x 16 = 16^2

3 digits (000 to FFF) = 4096 values = 16 x 16 x 16 = 16^3

Example math (15 + 1 = 16 right? Here’s how you do it in hex):

 1  (overflow aka carry the 1)
  F
+ 1
---
 10

Binary – Base 2

OK now the whole reason for this entry. We’re talking binary 1′s and 0′s the language of LOVEly computers. In binary, there are only 2 values, 0 and 1, off and on. I’m only going to deal with unsigned binary numbers (no negative numbers) because in my future entries, I’ll be explaining things like masks and bytes in regards to TCP/IP networking. Besides, I’m a generally positive guy and try to not dwell on the negative. On to the numbers!

1 digit (0 and 1) = 2 values = 2 = 2^1

2 digits (00 through 11) = 4 values = 2 x 2 = 2^2

3 digits (000 through 111) = 8 values = 2 x 2 x 2 = 2^3

8 digits (00000000 through 11111111) = 256 values = 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 2^8

Example math (1 + 1 = 2 of course! Now, let’s see what that looks like in binary):

 1  (overflow aka carry the 1)
  1
+ 1
---
 10

Ahh yes! There it is! The punch line to our joke! Feel free to laugh OR cry OR just pitty me for regurgitating this stuff from memory.

Bring on your questions! Do you need more examples? You might be asking yourself, “But in the world does this have to do with the OpenVPN configuration that Tom’s working towards?” For that, you’ll have to keep coming back to find out!

Digg this!Add to del.icio.us!Stumble this!Add to Techorati!Share on Facebook!Seed Newsvine!Reddit!

Leave a Reply:

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2011 Tom Pohl, All rights reserved.