## Introduction: the binary system code

### Binary numbers. Base two numeral system

In mathematics and in digital electronics, a binary number is a number written by using the binary numeral system, which is a base 2 numeral system. In this system, numeric values are represented by using only two different symbols: typically 0 (zero) and 1 (one). The base 2 system is a positional numeric system with a radix of 2. Binary is the way computers hold information, by using only the two symbols: the 1's and the 0's.

Examples of binary numbers: 01, 10, 001, 010, 011, 100, 101, 110, 111, etc.

The decimal numeral system (some call it denary system) we're all familiar with is a base-ten system, meaning that it uses ten distinct digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.

Examples of numbers in the decimal system: 1, 2, 3, 10, 101, 304, 579, 2746, 54206, etc.

### Counting in binary system

After 0 and 1, next it comes 10. In fact, when counting, whenever we reach a number that is made up entirely only of 1's, an extra 1 digit is added to the left of that number (leftmost bit) and the rest of the bits are cleared (all 0's). This way, after the number 111 it follows the number 1000. This is very similar to what is happenning in the decimal system: when we reach a number that is made up entirely of only 9's, an extra digit set on 1 is added to the left of the number, while the rest of the bits are cleared (0's). After 999 next it comes 1000.

#### Here are the first 32 (33) decimal system positive integer numbers (base 10) and their binary number representation equivalents (base 2):

- 0
_{(10)}= 0_{(2)} - 1
_{(10)}= 1_{(2)} - 2
_{(10)}= 10_{(2)} - 3
_{(10)}= 11_{(2)} - 4
_{(10)}= 100_{(2)} - 5
_{(10)}= 101_{(2)} - 6
_{(10)}= 110_{(2)} - 7
_{(10)}= 111_{(2)} - 8
_{(10)}= 1000_{(2)} - 9
_{(10)}= 1001_{(2)} - 10
_{(10)}= 1010_{(2)} - 11
_{(10)}= 1011_{(2)} - 12
_{(10)}= 1100_{(2)} - 13
_{(10)}= 1101_{(2)} - 14
_{(10)}= 1110_{(2)} - 15
_{(10)}= 1111_{(2)} - 16
_{(10)}= 1 0000_{(2)} - 17
_{(10)}= 1 0001_{(2)} - 18
_{(10)}= 1 0010_{(2)} - 19
_{(10)}= 1 0011_{(2)} - 20
_{(10)}= 1 0100_{(2)} - 21
_{(10)}= 1 0101_{(2)} - 22
_{(10)}= 1 0110_{(2)} - 23
_{(10)}= 1 0111_{(2)} - 24
_{(10)}= 1 1000_{(2)} - 25
_{(10)}= 1 1001_{(2)} - 26
_{(10)}= 1 1010_{(2)} - 27
_{(10)}= 1 1011_{(2)} - 28
_{(10)}= 1 1100_{(2)} - 29
_{(10)}= 1 1101_{(2)} - 30
_{(10)}= 1 1110_{(2)} - 31
_{(10)}= 1 1111_{(2)} - 32
_{(10)}= 10 0000_{(2)}

As you can see, there are 32 distinct numbers that can be represented on 5 digits or less (from 0 up to 31). This can also be calculated, since 32 = 2^{5}. The volume of distinct numbers that can be represented on 8 digits is: 2^{8} = 256. From 0 up to 255. 255 in binary is 1111 1111. Because the binary system uses base two, as opposed to the decimal base ten, the numbers written in binary code get more digits, but they both obey the same principles.