The **binary** numeral system (**base 2**) number system, represents numeric values using two symbols, 0 and 1. {0,1}

The **decimal** numeral system (**base 10**) number system, represents numeric values using ten symbols {0,1,2,3,4,5,6,7,8,9}

The **hexadecimal** numeral system (**base 16**) number system, represents numeric values using sixteen symbols {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}

**General base(b) with length n-1 to decimal(10) conversion**

The general formula is listed below :

where k_{n} is the coefficient converted in base 10 of the position n

Binary to decimal example :

length=5=n-1=>n=4

11011_{base2} = (1*2^{4} + 1*2^{3} +0*2^{2} + 1*2 + 1)_{base10} = 27_{base10}

Hex to decimal example :

length=5=n-1=>n=4

FA30D_{base16} = (15*16^{4} + 10*16^{3} + 3*16^{2} +0*16 + 13)_{base10} = 1024781_{base10}

Another useful formula is :**
base ^{length} -1 = maximum number in base 10
**or more mathematically

Using the definition of the logarithm we have :

(1)

The change base of the logarithms formula is :

(2)

Using the (1) and then the (2) we have :

Finally we get :

(3)

Where n is the length (number of bits) and max_{10} is the maximum number in base 10.

a) Binary example :

The length in computing is counted in bits. A byte has 8 bits (length).

With this in mind we can see that the maximum decimal number that we can reach with one byte (8 bits) is :

2^{8} - 1 = 255_{10 }(0-255 => 256 elements)_{
}

b) Another binary example :

How many bits are needed to get a 1024 (0-1023) different elements in base 10 ?

We see that :

2^{8} - 1 = 255_{10 }(0-255 => 256 elements)_{
}2^{9} - 1 = 511_{10} (0-511 => 512 elements)_{
}2^{10} - 1 = 1024_{10} (0-1023 => 1024 elements)

So the answer is 10 bits or 2 bytes (16 bits)_{.}

Another solution is by using the formula (3) ... So we have : ln(1024)/ln(2) = 10 bits

Notice that we will focus in the binary numeral system, or base-2 number system, because is used internally by almost all modern computers.

c) Example what is the maximum unsigned integer number we can reach using the arduino?

From the specifications we can see that unsigned integer number is a 2 byte value. => 2*8=16 bit (length)

2^{16} - 1 = 65535_{10 }(0-65535 => 65536 elements)_{
}