Sum of digits of sum of digits of sum of digits of $7^{7^{7^7}}$

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.


  • $7^{3n}\equiv 1 \pmod 9$, $7^{3n+1}\equiv 7 \pmod 9$, $7^{3n+2}\equiv 4 \pmod 9$
  • $7^{m}\equiv 1 \pmod 3$
    • so $7^{7^{7^7}} \equiv 7 \pmod 9$ and is of the form $9k+7$ for some $k$
  • any number less than $17$ (actually $79$) of the form $9k+7$ has a digit sum of $7$
    • $7 \lt 10$
  • any number less than $10^{10}+7$ (actually $8\times 10^{72}-1$) of the form $9k+7$ has a digit double sum of $7$
    • $7^7 \lt 10^{10}$
  • any number less than $10^{10^{10}}+7$ (actually $8 \times 10^{8\times 10^{72}-8} -1$) of the form $9k+7$ has a digit triple sum of $7$
    • $7^{7^7} \lt 10^{10^{10}}$
  • any number less than $10^{10^{10^{10}}}+7$ (actually $8\times 10^{8 \times 10^{8\times 10^{72}-8} -8}-1$) of the form $9k+7$ has a digit quadruple sum of $7$
    • $7^{7^{7^7}} \lt 10^{10^{10^{10}}}$

So $7^{7^{7^7}}$ has a digit quadruple sum of $7$


I propose the following definition for the (recursive) sum-of-digits function

  \\ Pari/GP-Code     
  {sod(n) = local(s,d);
     while(n>9, 
           s=0; while(n>0,
                    d=n % 10;  \\ the last digit to "d"
                    s=s+d;     \\ add "d" to the digit-sum "s"
                    n=n\10;   \\ shift n one decimal digit to the right
                    );    \\ s has now the number of digits of n,
           n=s);  \\ because possibly s>9 we use this as new n and repeat  
      return(n);} 

If we check now the sum-of-digits of consecutive powers of $7$ we get

vector(12,r,sod(7^(r-1 )))
 %969 = [1, 7, 4, 1, 7, 4, 1, 7, 4, 1, 7, 4]

and we see, that this is simply periodic with period $3$

vector(12,r,sod(7^((r-1) % 3)))
 %970 = [1, 7, 4, 1, 7, 4, 1, 7, 4, 1, 7, 4]

After that we need the residue of the exponent $\;^37 \pmod 3$ which- since $7 \equiv 1 \pmod 3$ is $1$.

So we have $$ \text{sod}(\;^47 ) = \text{sod}(7^{\;^37 \pmod 3} ) =\text{sod}(7^{1}) = 7 $$


update
To see, whether exactly 4-times iterated sum-of digits would arrive at a one-digit number I've estimated this using Pari/GP:
Here nd_xxx means "number-of-digits of xxx" , sd_xxx sum of digits of xxx. The sum is simply estimated by the average of the possible digits meaning sd_XXX = 4.5 * nd_XXX. Z is here $ \;^47$.

nd_Z=%59 \\= 7^7^7^*log(7)/log(10)   
 %85 = 3.17741949328 E695974   \\ number digits of Z

A=sd_Z=4.5*nd_Z
 %86 = 1.42983877198 E695975   \\ estimated sum of digits of Z  

nd_A=log(A)/log(10)            \\ number of digits of A
 %87 = 695975.155287

B=sd_A=4.5*nd_A                \\ est. sum of digits of A 
 %88 = 3131888.19879

nd_B=log(B)/log(10)            \\ est. number of digits of B
 %89 = 6.49580625035

C=sd_B=4.5*nd_B                \\ est. sum of digits of B
 %90 = 29.2311281266

nd_C=log(C)/log(10)            \\ est. number of digits of C
 %91 = 1.46584557655

D=sd_C=4.5*nd_C                \\ est. sum of digits of C
 %92 = 6.59630509448

So using the sum-of-digits recursively 4 times might arrive at a single digit number.


However, this answer might have missed the exact point of the question. I consider to delete it later.