For each positive integer $n$ , $S(n)$ is the sum of the digits of $n$ . For example $S(2017)=2+0+1+7=10$ . Find the value of

$S(S(S(4444^{4444})))$

The answer is 7.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

Let $T(n)$ mean the number of $n$ 's digits. For example: $T(2017)=4$ .

Since $T(4444^{4444})<T(10000^{4444})=T((10^4)^{4444}=10^{17776})=17777$ , it is clear that $S(4444^{4444})<17777*9=159993$ .

Therefore $S(S(4444^{4444}))<S(99999)$ , because the sum of the digits of $99999$ is at least as big as the $S(.)$ of any other number less than $159993$ . $S(99999)=45$ .

From that $S(S(S(4444^{4444})))$ is at most $S(39)=12$ . (Because $39$ has the highest $S(.)$ of any number less that $45.$ )

We also know that if we divide $S(S(S(4444^{4444})))$ by $9$ , the remainder is the same as the remainder upon dividing $4444^{4444}$ by $9$ .

Since $4444\equiv7 \ \mod9$ , and $7^3=343\equiv1 \ \mod9$ , we get $4444^{4444}\equiv7^{4444}=7*7^{4443}=7*(7^3)^{1481}\equiv7 \ \mod9$ .

The answer must be $\boxed{7}$ .