Binary Decimal and Hexadecimal numeral systems

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 :
(k_n b^n + k_{n - 1}b^{n - 1}+\ldots+k_1 b + k_0 )_{baseb}=x_{base10}

where kn is the coefficient converted  in base 10 of the position n

Binary to decimal example :
length=5=n-1=>n=4
11011base2 = (1*24 + 1*23 +0*22 + 1*2 + 1)base10 = 27base10

Hex to decimal example :
length=5=n-1=>n=4
FA30Dbase16 = (15*164 + 10*163 + 3*162 +0*16 + 13)base10 = 1024781base10

Another useful formula is :
baselength -1 = maximum number in base 10
or more mathematically
b^n-1=\max _{10}

Using the definition of the logarithm we have :
\log _b x=y\Leftrightarrow b^y=x (1)

The change base of the logarithms formula is :
\log{}_b(x)=\frac{{\log _k (x)}}{{\log _k (b)}}(2)

Using the (1) and then the (2) we have :
  \begin{array}{l}  b^n - 1 = \max _{10} \Leftrightarrow b^n = 1 + \max _{10} \mathop \Leftrightarrow \limits^1 \log _b (1 + \max _{10} ) = n\mathop \Leftrightarrow \limits^2 \\  n = \frac{{\ln (1 + \max _{10} )}}{{\ln b}} \\  \end{array}

Finally we get :
n = \frac{{\ln (1 + \max _{10} )}}{{\ln b}}(3)
Where n is the length (number of bits) and max10 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 :
28 - 1 = 25510  (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 :
28 - 1 = 25510  (0-255 => 256 elements)
29 - 1 = 51110  (0-511 => 512 elements)
210 - 1 = 102410  (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)
216 - 1 = 6553510  (0-65535 => 65536 elements)