# Integers $n$ for which the digit sum of $n$ exceeds the digit sum of $n^5$

This question is strongly inspired by The smallest integer whose digit sum is larger than that of its cube? by Bernardo Recamán Santos.

The number $n=124499$ has digit sum $1+2+4+4+9+9=29$ while its fourth power $n^4=240250031031001002001$ has a (strictly) smaller digit sum $2+4+0+2+5+0+0+3+1+0+3+1+0+0+1+0+0+2+0+0+1=25$.

In general, for a fixed integer exponent $k \ge 2$ we can ask for the set of positive integers $n$ whose digit sum exceeds that of $n^k$. One finds:

$$\begin{array}{|r|l|} k & \text{values n so that \mathrm{digsum}(n)>\mathrm{digsum}(n^k)} \\ \hline 2 & 39, 48, 49, 79, 149, 179, 249, 318, 348, 349, 389, 390, 399, \ldots \\ 3 & 587, 5870, 28847, 28885, 28887, 46877, 48784, 49468, 49639, \ldots \\ 4 & 124499, 1244990, 12449900, 124499000, 594959999, 1244990000, 1349969999, \ldots \\ 5 & ? \\ \hline \end{array}$$

An immediate observation is that if $n$ belongs to a row above, so does $10^j \cdot n$ since appending a bunch of zeroes does not change the digit sum of $n$ or its power $n^k$. An $n$ value not ending in $0$ can be thought of as "primitive".

From a comment in A122484 we know that in the $k=4$ case the formula:

$$f(i)=75\cdot 10^{2i}-4\cdot 10^{i+1}-1 \quad , \quad i=7,8,9,10,\ldots$$

miraculously produces infinitely many "primitive" $n$ values for $k=4$.

The question here is, do numbers like this exist for exponent $k=5$ and higher?

(Or: In $39,587,124499,\ldots$, what comes next?)

Even if heuristics seem to imply that it is improbable for high values of $k$ (the number of digits increases dramatically when going from $n$ to $n^k$), maybe there exist miraculous formulas in the style of $f(i)$ above which produce examples for $k=5$ or higher?

We note that if we leave base $10$ and go to much higher radixes $b$, then it becomes easy to find examples for $k=5$.

• No solutions below $10^8$. – Lucian Aug 18 '15 at 21:29
• Nothing below $1.695 \times 10^9$. – 727 Aug 21 '15 at 4:43

Such formulas for such numbers exist for all even $k$. The formula is not as magical as it seems. Consider

$$10^{ni}-m\sum_{s=0}^{n-1}10^{si}\;.$$

with fixed $m,n$ for all $i$. There are $n$ stretches of $O(i)$ nines in this number. Taking it to the $k$-th power yields

$$\left(10^{ni}-m10^{(n-1)i}\right)^k+R\quad\text{with}\quad R\in o\left(10^{k(n-1)i}\right)\;.$$

For even $k$, the terms with the highest powers of $m$ in the remainder $R$ are all positive, so by making $m$ large enough, we can make all terms in $R$ positive. Then we only have $k/2$ negative terms in the leading power, and hence only $k/2$ stretches of $O(i)$ nines, and all other stretches of $O(i)$ repeating digits are zeros. The remaining constant digits contribute $O(1)$ to the digit sum, so for $n\gt k/2$ the larger number of $O(i)$ stretches of nines wins out for sufficient $i$.

Unfortunately this doesn't work for odd $k$, since $R$ then contains a mixture of signs. Nevertheless, one could systematically search for such formulas using the ansatz

$$\sum_{s=0}^nc_s10^{si}\;,$$

expanding the $k$-th power and solving the linear program resulting from requiring that only a small number of terms are negative.

• I could find many examples for $k=6$ with your first formula. Such as $(m,n,i)=(10,9,29)$ which gives $10^{261}-10\sum_{s=0}^8 10^{29s}$. This number has a digit sum of $2332$ while its sixth power has a digit sum of only $2305$. It seems you are right this produces infinitely many examples for $k=6$, so this is really interesting. However it is hard to say what the smallest for $k=6$ is (I mean examples that do not come from your formula)? Is it your opinion that one can find explicit examples for $k=5$ with the program your propose? – Jeppe Stig Nielsen Aug 28 '15 at 12:15
• @JeppeStigNielsen: It's hard to tell for $k=5$. There are a lot of signs to get right, and it might not be possible. I played around a bit with some $c_s$ for $n=2$ but always got at least three minus signs in the $5$-th power. It shouldn't be too much effort to implement the systematic search, though. For $k=6$: I only chose the simple form where all terms except the highest have coefficient $m$ to simplify the proof. If you're looking for small examples, you might want to try more general coefficients (like what I proposed for $k=5$). (Also, $n=4$ should be enough for $k=6$.) – joriki Aug 28 '15 at 12:20
• A somewhat small example for $k=6$ with $n=5$ "stretches" of nines is, explicitly, $$009999999999999999999999999999999998\\ 999999999999999999999999999999999998\\ 999999999999999999999999999999999998\\ 999999999999999999999999999999999998\\ 999999999999999999999999999999999999$$ This is just under $10^{5 \cdot 36 - 2} = 10^{178}$. Your formula gave two figures zero at the end which I moved to the front. – Jeppe Stig Nielsen Aug 28 '15 at 22:07