- Binary System
- Tertiary System
- Octal System
- Decimal System
- Hexadecimal System
- Roman Numeral System
- Base64 Encoding
The binary, or base-2, system uses only two digits: 1 and 0. It is the language spoken by all computers, so if you were to read a computer's raw data all you would see is a seemingly random sequence of 1s and 0s.
Now, to read this, you need to locate the last, or right-most, digit. This is the 20, or "ones", place. The place directly to the left of it is the 21, or "twos", place, next to that is the 22 place, next to that is the 23 place, etc, so the line: 100101011 would be read as...
- (28 x 1) + (27 x 0) + (26 x 0) + (25 x 1) + (24 x 0) + (23 x 1) + (22 x 0) + (21 x 0) + 1,
- 256 + 0 + 0 + 32 + 0 + 8 + 0 + 2 + 1, or
- 256 + 32 + 8 + 2 + 1
...which equals 299.
Tertiary (tur-she-air-ee) System
The tertiary, or base-3, system uses the three digits 0, 1, and 2.
A sample looks like this: 2012201. To read, once again, start from the right-most place, and this is the 30 place, to the immediate left is the 31 place, and so forth, so the previous example is read like this...
- (36 x 2) + (35 x 0) + (34 x 1) + (33 x 2) + (32 x 2) + (31 x 0) + 1,
- 1458 + 0 + 81 + 54 + 18 + 0 + 1, or
- 1458 + 81 + 54 + 18 + 1
...which equals 1612.
The octal, or base 8, system uses eight digits from 0 to 7, and is most commonly used to represent 3 binary places. In other words, one octal digit stands for three binary digits.
An octal number looks like 1647205, and is read the same way as other systems, so the right-most place is the 80 place, to left of that is the 81 place, then the 82 place, etc. So given that, the previous octal number is read as...
- (86 x 1) + (85 x 6) + (84 x 4) + (83 x 7) + (82 x 2) + (81 x 0) + (80 x 7),
- 262,144 + 196,608 + 16,384 + 3,584 + 128 + 0 + 7, or
- 262,144 + 196,608 + 16,384 + 3,584 + 128 + 7
...which equals 478,855.
The decimal, or base-10, system uses all the digits from 0 - 9. It should already be familiar to you. Why? Because you count with it. That's right, the counting system is also the decimal system. I probably won't have to tell you how to read it, but I thought I should put it on here in case there are "some" people reading this.
Hexadecimal (hex-uh-de-see-mull) System
The hexdecimal, base-16, or Hex, system uses all the digits from 0 - 9 and the letters A - F (representing 10 - 15). The Hex system is usually used to shorten the binary system, like the octal system. One Hex digit represents four binary digits.
A Hex number looks like 148AB5. The right -most place is the 160 place, to the left is the 161, next to that is the 162, etc. You read the given sample like this:
- (165 x 1) + (164 x 4) + (163 x 8) + (162 x 10) + (161 x 11) + (160 x 5) or
- 1,048,576 + 262,144 + 32,768 + 2,560 + 176 + 5
...which equals 1,346,229.
---Hex and HTML
Hex is used in HTML?! Sure. Hex is used as a "colour creator". See, when you want to colour a webpage's background, text, etc., you either use predetermined colours or hexadecimal digits. This webpage's background colour is 80FF00, no that doesn't stand for 8,453,888, but actually 80-FF-00, or 128-255-0. This combination denotes the amount of red, green, and blue pigments, respectively, so there is 128 red pigments, 255 green pigments, and 0 blue pigments. Black is 000000, or 0-0-0, and white is FFFFFF, or 255-255-255. See my HTML Colours page for a list of colours.
Roman Numeral System
OK, so Roman Numerals technically aren't a number system used in computers, but I think people need to know them and this is the most appropriate place to put them. They were first used in the Ancient Roman Empire (duh!) but were used widespread starting in Mediæval times (Middle Ages). This numeral system gives specific letters number values and arranges them in such a way in that they can write any number using the most well-known symbols (and how you arrange them).
The following letters that were given numerical values are:
- I - 1
- V - 5
- X - 10
- L - 50
- C - 100
- D - 500
- M - 1,000
A bar can be written above the numberal to indicate multiplication by a thousand (although this is used only for numbers larger than 3,999). For example: V = 5, and V = 5000.
Reading Roman Numerals requires some basic addition and subtraction skills. If a larger number comes before a smaller number, or if two equal numbers appear side-by-side; then add the two together: XI = 10 + 1 = 11. If a smaller number comes before a larger number, then subtract the smaller number from the larger number: IV = 5 - 1 = 4. You always add or subtract from left-to-right (but you subtract before you add). Therefore CMV = (1,000 - 100) + 5 = 905, and MCD = 1,000 + (500 - 100) = 1400. Generally, you will see IV for 4, but it is acceptable to write IIII instead. Do you know what the following sequences of Roman Numerals mean?
- Lastly, MXLVIIIDLXXVI
OK, this is another not-really-a-number-system number system. It is used for binary-to-text encoding by the Multipurpose Internet Mail Extensions (MIME) specification. Base64 uses 64 characters, and is broken down as such:
- Characters 0-25 are the uppercase alphabet (A-Z)
- Characters 26-51 are the lowercase alphabet (a-z)
- Characters 52-61 are the numerals 0-9
- Characters 62-63 are "+" and "/", respectively
- An additional character, the equals character ("="), is used as a padding character
The process by which ASCII text is encoded into base64 is the following:
- Each character is changed into its ASCII code
- The ASCII code is then converted to its 8-bit binary equivalent
- The string of 8-bit binary characters is divided into 24-bit strings (3 8-bit characters), which is then broken into 4 6-bit characters
- If any bits are left over, zeros are added on to them until they become 24 bits long).
- Each 6-bit character is converted to a base64 code numeral, which is then changed into its character equivalent, and for every 8-bit sequence of zeros at the end of the 24-bit string, an equals character is added to the end of the base64 string
An example for your wondering mind: (Bold indicates added zeros)
- For my alias, Cyndaquazy, the ASCII sequence is 67-121-110-100-97-113-117-97-122-121
- That 8-bit character string is 01000011-01111001-01101110-01100100-01100001-01110001-01110101-01100001-01111010-01111001
- When broken into a 24-bit character string it is 010000110111100101101110-011001000110000101110001-011101010110000101111010-011110010000000000000000
- That same 24-bit sequence in 6-bit characters: 010000-110111-100101-101110-011001-000110-000101-110001-011101-010110-000101-111010-011110-(01-0000)0000-00000000
- The base64 code sequence is 16-55-37-46-25-06-05-49-29-22-05-58-30-16 and then 2 ='s are added because of the two 8-bit characters at the end.
- The base64 string is Q3luZGFxdWF6eQ==