# Find all $n$ so that $s(2^n)=s(5^n)$

Let $s(k)$ be the sum of digits of the number $k$. Find all $n$ so that $s(2^n)=s(5^n)$

I have got that $n=3$ is one solution. And looking modulo 9 it's easy to get that 3 has to divide $n$.

$n=0$ is another. It seems very unlikely that there are any more, but also difficult to prove. $2^6=64, 5^6=15625$ and $2^9=512, 5^9=1953125$ fail. $5^n$ has so many more digits than $2^n$ that it is hard to believe that $2^n$ can ever catch up.

• they get close at $n=13$. but appear to grow apart on average Jan 18, 2015 at 1:07
• @David: but we already knew that $n$ had to be a multiple of $3$. $5^{13}$ has a lot of small digits. Jan 18, 2015 at 3:16

As was noted during the discussion of this question, the digits of $k^n$ are created quite similar to a pseudo random number generator, so the heuristic is that $s(k^n)$ is about the average digit value times the length of the decimal number string: $$s(k^n) \approx h(k, n) = 4.5 \frac{\ln(k)}{\ln(10)} n$$

Like Ross Millikan noted, this will make it hard for $s(2^n)$ to catch up with $s(5^n)$. $s(2^n)$ would need a $n$ with a large deviation up and/or a large deviation down from $s(5^n)$.

Example: $$\begin{array}{c|c|c|c|c} n & s(2^n) & h(2, n) & s(5^n) & h(5, n) \\ \hline 10 & 7 & 13 & 40 & 31 \\ 100 & 115 & 135 & 283 & 314 \\ 1000 & 1366 & 1354 & 3172 & 3145 \\ 10000 & 13561 & 13546 & 31117 & 31453 \\ 100000 & 135178 & 135463 & 313339 & 314536 \\ \end{array}$$

One thing to consider is the distribution of digits across $2^n$ and $5^n$.

Number of digits formulas:

$$\#_{2^n} = \left\lfloor\frac{n \log 2}{\log 10}\right\rfloor + 1$$

$$\#_{5^n} = \left\lfloor\frac{n \log 5}{\log 10}\right\rfloor + 1$$

$$\lim_{n \to \infty} \frac{\#_{5^n}}{\#_{2^n}} = \log_2 5 \approx 2.32$$

The limit of the ratio of the number of digits in both numbers converges. We can comfortably say that the ratio is defined for all natural numbers (since it's defined for all real numbers).

Average digit formulas:

$$\bar{d_{5^n}} = \frac{s(5^n)}{\#_{5^n}}$$

$$\bar{d_{2^n}} = \frac{s(2^n)}{\#_{2^n}}$$

So, we can make an equivalent statement to $s(2^n) = s(5^n)$.

$$\bar{d_{2^n}} = \frac{\#_{5^n}}{\#_{2^n}} \bar{d_{5^n}}$$

Now, we consider whether or not that second statement is possible for $n > 3$. The ratio becomes $2$ as early as $n = 8$, which means that the average digit of the $2^n$ must be twice that of $5^n$, etc up to the ratio of $\log_2(5)$.

You need to show that it is possible for some other $n > 3$ or there is some $k$ for which it is no longer possible for $n > k$.