TITLE: Numbers $n$ such that the digit sums of $n, n^2,\cdots,n^k$ coincide.
QUESTION [40 upvotes]: Let $S(n)$ be the digit sum of $n\in\mathbb N$ in the decimal system. When I was playing with numbers, I noticed the followings :
$$S(\color{red}{9})=9=8+1=S(81)=S\left(\color{red}{9^2}\right)$$$$S(\color{red}{18})=1+8=3+2+4=S(324)=S\left(\color{red}{18^2}\right)$$$$S(\color{red}{19})=1+9=3+6+1=S(361)=S\left(\color{red}{19^2}\right)$$$$S(\color{red}{45})=4+5=2+0+2+5=S(2025)=S\left(\color{red}{45^2}\right)$$
Also, I found the followings :
$$S(\color{red}{468})=S\left(\color{red}{468^2}\right)=S\left(\color{red}{468^3}\right)$$
$$S(\color{red}{585})=S\left(\color{red}{585^2}\right)=S\left(\color{red}{585^3}\right)$$
$$S(\color{red}{5868})=S\left(\color{red}{5868^2}\right)=S\left(\color{red}{5868^3}\right)$$
However, I have not been able to find $n\in\mathbb N$ such that
$$n\ge 2\ \text{ and }\ n\not\equiv 0\pmod{10}\ \text{ and }\ S(n)=S\left(n^2\right)=S\left(n^3\right)=S\left(n^4\right).$$
So, here is my question.

Question : What is the max of $k\in\mathbb N$ such that there exists at least one $n\in\mathbb N$ which satisfies the following condition?
Condition : $n\ge 2 \text{ and } n\not\equiv 0\pmod{10} \text{ and } S(n)=S\left(n^2\right)=\cdots=S\left(n^k\right)$.

Note that we have $k\ge 3$ and $n\equiv 0,1\pmod 9$. Can anyone help?
Added : I've just found that we have $n\gt 2967089989969$ for $k=4$ since none of the integers of this page(OEIS), where we can see the numbers of $k=3$, is the number of $k=4$.
Added : A user Nikhil Mahajan found that we have $n\gt 10^{13}$ for $k=4$.

REPLY [24 votes]: The following probabilistic argument suggests that $k=3$ is very likely
the maximum.
For $0 \leq \sigma \leq 9$ define
$$
b(\sigma) = \min_{0 \leq x \leq +\infty} x^{-\sigma} \sum_{i=0}^9 x^i.
$$
Thus $b(0)=b(9)=1$ and $b(9/2) = 10$.
Lemma.  Suppose $0 \leq s \leq 9d$.  Of the $10^d$ integers in $[0,10^d)$,
at most $b(s/d)^d$ have digit sum $s$.  The inequality is strict unless
$s=0$ or $s=9d$.
Proof: Fix $d$, and let $N_s$ ($0 \leq s \leq 9d$)
be the number of integers in $[0,10^d)$ with digit sum $s$.
Then the $N_s$ have the generating polynomial
$$
\sum_{s=0}^{9d} N_s X^s = \left( \sum_{i=0}^9 X^i \right)^d.
$$
It follows that
$$
N_s \leq x^{-s} \sum_{s'=0}^{9d} N_{s'} x^{s'}
    = x^{-s} \left( \sum_{i=0}^9 x^i \right)^d
$$
for all $x>0$.  Choosing the $x$ that minimizes this upper bound
yields $N_s \leq b(s/d)^d$ as claimed, and it is clear that
equality holds only for $s=0$ and $s=9d$.  $\Box$
(Using contour integration one can show that this upper bound
is within a factor $O(\sqrt d\,)$ of the actual count.)
Now for large $d$ it seems reasonable to expect that for random
$n \in [0,10^d)$ the digit sums  $S(n),S(n^2),\ldots,S(n^k)$
behave like random variables, independent except for the congruence mod $9$,
with each $n^j$ behaving like a random $jd$-digit number.  This means
that the number of $d$-digit numbers $n$ for which $S(n)=S(n^2)=\cdots=S(n^k)$
is at most $B_k^d$, where
$$
B_k = \max_{0 < \sigma < 9} b(\sigma) \prod_{j=2}^k 
  \left( \frac{b(\sigma/j)}{10} \right)^j.
$$
Numerical calculation finds $B_k \doteq 10, 6.56, 2.36, 0.39$
for $k=1,2,3,4$.  Thus we expect infinitely many solutions for $k \leq 3$
but only finitely many for $k \geq 4$, and probably none now that
Nikhil Mahajan has searched up to $k=8$ and found nothing.
Indeed even $S(n) = S(n^4)$ should have only finitely many solutions
(possibly none other than $n=7,19,67$) because even
$\max_\sigma b(\sigma) \, (b(\sigma/4)/10)^4$ is about $0.855 < 1$.
If you want to look for further examples, concentrate on $n \equiv 0,1,4,7 \bmod 9$
with $S(n)$ approximately equal to $7$ times the number of digits of $n$.
Some large examples of $S(n)=S(n^2)=S(n^3)$ are
$n = 4659468895$, $n = 22898799351$, and $n=319879688698$.