To find the largest integer in base-10 that can be represented in an n-bit integer word, let’s do this inductively.
- If you have 3 bit-word, the highest number is (111) of base-2 which is 7 (1*2^2+1*2^1+1*2^0) of base-10,
- If you have 4 bit-word, the highest number is (1111) of base-2 which is 15 (1*2^3+1*2^2+1*2^1+1*2^0) of base-10,
- if you have 5 bit-word, the highest number is (11111) of base-2 which is 31 (1*2^4+1*2^3+1*2^2+1*2^1+1*2^0) of base-10.
There is a trend here: 3 bit-word stores a maximum number of 7 (2^3-1), 4-bit word stores a maximum of 15 (2^4-1), 5 bit-word store a maximum number of 31 (2^5-1), and so on. This means that the maximum number stored in n-bit word stores a maximum number of 2^n-1.
We can derive the maximum number by knowing that the maximum base-10 number in a n-bit word is the summation series:
1*2^(n-1)+1*2^(n-2)+………+1×2^0.
This is a geometric progression series. The formula for the sum of a geometric series
a+ar+ar^2+…+a*r^n =a*(1-r^(n+1))/(1-r), r ≠ 1,
Hence,
1*2^(n-1)+1*2^(n-2)+………+1×2^0=1*(1-2^(n))/(1-2)=2^n-1 _____________________________________________________________