For positive integer $n$, why is $\lfloor \log_{10}(2^n)\rfloor + \lfloor \log_{10}(5^n)\rfloor + 2 = n+1$

algebra-precalculusceiling-and-floor-functionsintegerslogarithms

For positive integer $n$, why is $\lfloor \log_{10}(2^n)\rfloor + \lfloor \log_{10}(5^n)\rfloor + 2 = n+1$?

This question comes from counting the number of digits of $10^n$ in terms of the number of digits of $2^n$ and $5^n$. Number of digits of $10^n$ is $n+1$ which equals to the sum of the number of digits of $2^n$ and $5^n$. I know that the number of digits of a positive integer $x$ is $\lfloor \log_{10}(x)\rfloor + 1$.

Using programming, I've checked that this is true for $n$ less than $100$.

Best Answer

$\lfloor{\log_{10}(2^n)}\rfloor = \lfloor{\log_{10}(10^n) - \log_{10}(5^n)}\rfloor = n + \lfloor{ - \log_{10}(5^n)}\rfloor = n - \lfloor{\log_{10}(5^n)}\rfloor - 1$

So:

$\lfloor{\log_{10}(2^n)}\rfloor + \lfloor{\log_{10}(5^n)}\rfloor + 2 = n - \lfloor{\log_{10}(5^n)}\rfloor - 1 + \lfloor{\log_{10}(5^n)}\rfloor + 2 = n + 1$

Related Question