[Math] Sum of digits of sum of digits of sum of digits of $7^{7^{7^7}}$

big numbersnumber theory

On the back of a mathematical magazine, I came across some "quick facts" about the number 7. Most of them were real life related ones, like "Rome was buit on 7 hills", "the neck of most mamals is made out of 7 bones", "a ladybird has 7 black spots on its back" etc.

But the last one was very intriguing: denote by $A$ the sum of digits of the number $7^{7^{7^7}}$, by $B$ the sum of digits of $A$, and by $C$ the sum of digits of $B$. What is the sum of digits of $C$?

After doing some research on the power of usual computers, I concluded that it would not be possible to calculculate this number and find the sums like this. So the solution must be pure mathematical. But I could not manage to find any path to a solution. If it helps, we have that $7^7=823543$ which has sum of digits $25$, but online big number calculators can't even compute $7^{7^7}$, and I figured it was not worth it to write such a program myself.


Edit: After some good hours I want to draw some conclusions about the question as well as proposing some extensions.

We saw that for the proposed number $^4 7$, the searched sum is $7$. Mees de Vries found a rigorous proof for that, but which doesn't seem to work in a general case; Henry gave a quite tedious solution which may be generalizable with some extra explanations needed, and Gottfried Helms came up with a computer algorithm which he used to deduce that the sum of digits (repeated as many times as necessary) will repeat with period 3 across consecutive powers of 7.

Now, based on the fact that from Euler's Theorem we will get that $^n 7$ has residue $7$ mod 9, for any $n\in\mathbb{N}^*$, I came to believe that if we repeatedly do sum of digits for larger $^n 7$ we will also get 7. The question is how many times we would have to do the sum-of-digits. Also, I would like to notice that the number 7 here is not a simple coincidence. It is because it is $\varphi(9)+1$, and the sum-of-digits conserves mod 9. It would be interesting to find a similar property for 3, which has totient function 2, and also "conserves" the residue of the sum-of-digits (here it seems that the sum will be 9 – at least this is how it is for $3^3$ and $3^{3^3}$).

Thanks for all your answers!

Best Answer

Let $\mathrm{sod}$ stand for the upper-bounded sum-of-digits operation, that is, $$ \mathrm{sod}(n) = \sup_{m \leq n}\left( \text{sum of digits of $m$}\right). $$ This has the nice advantage that it is trivially a monotone function.

If we can prove that $$ \mathrm{sod}^4\left(7^{7^{7^7}}\right) < 10, $$ we can use Euler's theorem to quickly conclude, because applying the (ordinary) sum of digits operation does not change the residue modulo 9. But let's let WolframAlpha do the work for us, to see that the result will be 7.

Note that $\mathrm{sod}(n) \leq 9(\log_{10}(n) + 1)$, as $\log_{10}(n) + 1$ is an upper bound on the number of digits in the number $n$, and each digit is at most 9. Let's focus on the case where $n$ has at least two digits, so that in fact this is upper bounded by $18\log_{10}(n)$. Then we have that $$ \mathrm{sod}^4\left(7^{7^{7^7}}\right) \leq \mathrm{sod}^3\left(7^{7^7} \cdot 18 \cdot \log_{10}(7)\right) \leq \mathrm{sod}^2\left(7^7\cdot 18 \cdot \log_{10}(7) + 18\log_{10}(18) + 18\log_{10}^2(7)\right). $$ (Note that we are using the monotonicity of our $\mathrm{sod}$ function here! This is why we made the definition.)

The number in the argument of $\mathrm{sod}^2$ is small enough that we can just evaluate it for simplicity: it is certainly upper bounded by 12527573. The $\mathrm{sod}$ of this number is the sum of digits of $9999999$, which is $7 \times 9 = 63$, and we are left just barely (!) able to conclude, because the $\mathrm{sod}$ of this number is the sum of digits of $59$, which is $14$. Despite the fact that this is larger than the 10 we claimed we needed above, we are still done: if the sum of digits we were after were greater than 7 it would have to be at least 16, and it cannot be, thus we conclude that the result is indeed 7.