# Find all $n\in\mathbb{Z}^+$ such that the sum of the digits of $5^n$ equals $2^n$ [duplicate]

Find all $n\in\mathbb{Z}^+$ such that the sum of the digits of $5^n$ equals $2^n$

Starting with a table of values, I found that $n=3$ works. Beyond this, it's hard to imagine any other number working. As $n$ gets larger, it seems to me that $2^n$ grows far more rapidly than the sum of the digits of $5^n$ would ever be able to "catch up" to.

My reasoning: multiplying by each $2$ doubles $2^n$, but multiplying by each $5$ adds (I think) at most $1$ digit to $5^n$, which would add at most $9$ to the sum of the digits of $5^n$. Another way of looking at it, suppose $n=1000000$. Notice that $5^{1000000}<10^{1000000}$, which is $1$ with $1000000$ zeros. Thus $5^{1000000}$ has at most $1000000$ digits, and the sum of its digits would be maximized if those digits were all $9$s. Then the sum of the digits of $5^n$ would be $9\cdot1000000=9000000$, which is far less than the number $2^{1000000}$.

But is there a way to prove this using theory?

## marked as duplicate by JMoravitz, Ross Millikan, Jonas Meyer, Peter Woolfitt, ElaqqadMar 29 '15 at 18:07

• Sounds like you already have the theory to me. What specific difficulty are you encountering trying to write this up as a general argument? (i.e. not just about $n=1000000$). – Erick Wong Mar 29 '15 at 16:09
• Indeed, try to find the smallest $n$ such that $9\cdot n\log_{10}5 < 2^n$. In otherwords, the smallest $n$ for which the sum of digits of $5^n$ is always smaller than $2^n$ regardless what the digits actually are. – JMoravitz Mar 29 '15 at 16:10
• @ErickWong Thank you, but my thinking (to me) is just "informal" and I don't think it's acceptable as a proof. – yroc Mar 29 '15 at 16:12
• One method would be induction. Show that, if $9n<2^n$, then $9(n+1)<2^{n+1}$ as well. You also need a starting-point, as JMoravitz says. – Empy2 Mar 29 '15 at 16:13
• That is a different question @Elaqqad, where it compares sum of digits of $5^n$ to sum of digits of $2^n$, whereas in this question we are comparing sum of digits of $5^n$ to the number $2^n$ itself. – JMoravitz Mar 29 '15 at 16:23

The number of digits of $5^n$ is $\leq n$. So, their sum is $\leq 9n$.

If $n\geq6$, $2^n>9n$. Therefore, we only need to test it for $n=1,2,3,4,5$

Out of those, it is only true for $n=3$.

• @I like your answer but, in a proof, is it not necessary to justify "the number of digits of $5^n\le n$" – yroc Mar 29 '15 at 16:31
• I skipped it since I thought it was obvious. But it is possible to prove it.  The number of digits of a positive integer is an increasing function (Let's write is a $d(n)$). So $$\forall n\geq 1:d(5^n)\leq d(10^n-1)=d(10^n)-1=n+1-1=n$$ – Kitegi Mar 29 '15 at 16:47
• @yroc Note that Farnight's proof exactly follows your ad hoc argument that $5^{1000000} < 10^{1000000}$ is $1$ with $1000000$ zeroes, so it has at most $1000000$ digits. Very often the essence of writing a proof is to take something "obvious for one number" like this and distilling it so it becomes clear for all values of $n$ (or making it clear exactly which $n$ the same lline of reasoning applies to). It's a skill that I'd encourage you to cultivate. – Erick Wong Mar 29 '15 at 17:10
• @ErickWong That's good advice; thank you kindly. – yroc Mar 29 '15 at 19:56

Hint: Digital sum of a number $x$ in base $10$ is given by,

$$\sum_{n=0}^{\lfloor{\log_{10}(x)}\rfloor} \frac{1}{10^n} (x \bmod 10^{n+1} - x \bmod 10^n)$$

• @Hmm, good formula to know! Thanks. – yroc Mar 29 '15 at 16:36