3
$\begingroup$

Two numbers $2^k$ and $5^p$ are expanded first then written side by side i.e. adjacent to each other. Find the total number of digits in that case if $k = p = 2004$.

My approach :

$2004\times \log 5 = 1400 $
so number of digits would be $1401$.
$2004 \times log 2 + 1 = 604$
Total digits $= 2005$

  • 0
    More precisely $2004 \times \log 5 = 1400.7\ldots$ and $2004 \times \log 2 = 603.26\ldots$ but apart from that you are correct2012-06-27

2 Answers 2

2

If you are working in base 10 you have the number of digits of $x$ as $\lfloor \log_{10} x\rfloor+1$. Assume logs are to base 10 to simplify notation.

The number of digits you need is then, as you calculate:

$\lfloor \log {2^p}\rfloor+1+\lfloor \log {5^p}\rfloor+1 = \lfloor p\log {2}\rfloor+1+\lfloor p\log {5}\rfloor+1$

Aside from the fact that you might have a rounding error of 1, you can then use $p\log2+p\log5=p\log{10}=p$.

So your answer will be $p+2 \text { or } p+1$

Then note, as Henry points out, that the logs are related - the floor function always reduces the total by 1 and never by zero, because the logs are not rational, so the answer is $p+1$

  • 0
    @Bazinga: Yes, your approach works (though there is some rounding) and would work for more general $k$ and $p$2012-06-27
2

Your method works though for integer $k=p \gt 0$ you do not even have to calculate the logarithms.

Since $k \, \log_{10}(5) + k \,\log_{10}(2) = k \, \log_{10}(10) = k$ and the logarithms are not rational numbers, then the number of digits of the concatenated number must be $k+1$.