# Compute the sum of digits of an exponential.

I found an interesting exercise on Number Theory (maybe interesting just for me, as I don't know how to solve it).

Compute the iterative sum of digits of: $$1976^{1976}$$.

I really don't know how to solve this exercise. I noted that $$2025$$ is the next perfect square and $$2025-1976=49$$, so $$1976=2025-49$$, and $$49$$ is a perfect square too. So I have to compute the sum of digits of $$(45^2 - 7^2)^{45^2-7^2}$$. I don't know how would that help me, but seemed like a hint to me when I found these two square roots.

Please help me. Thank you very much!

• @Arthur I did not said that the difference between two perfect squares is a square, but that both numbers, 2025 and 49 are perfect squares. Thank you! – MM PP Oct 22 '18 at 14:32
• You're right, I misread. – Arthur Oct 22 '18 at 14:32
• Are you looking for the sum of the digits or for the iterated sum of the digits (which is essentially just the residue $\pmod 9$)? I don't really see how to get the literal sum of digits without brute force. To be sure, it's not that hard to do with brute force (just a couple of seconds in WA). – lulu Oct 22 '18 at 14:48
• Please tell us where you found this exercise. I do not think there is any shortcut to this problem, as stated, other than explicit computation. – астон вілла олоф мэллбэрг Oct 22 '18 at 14:51
• I think this is from some 1976 mathematical olympiad, and the correct version is: Compute the sum of the sum of the sum of the digits of $1976^{1976}$. But I can't find it online. It's not IMO 1976. – TonyK Oct 22 '18 at 15:03

## 1 Answer

(I am assuming "sum of digits" means "iterated sum of digits")

First note that the iterated sum of the (decimal) digits of a number $$n$$ is equal to $$n \mod 9$$.

Then note that $$(a^b) \mod 9= ((a \mod 9)^b) \mod 9$$.

So

$$(1976^{1976}) \mod 9 = ((1976 \mod 9)^{1976}) \mod 9 = (5^{1976}) \mod 9$$

Now calculate the first few powers of $$5$$ modulo $$9$$:

$$5^2 \mod 9 = 25 \mod 9 = 7$$

$$5^3 \mod 9 = 5 \times 7 \mod 9 = 35 \mod 9 = 8$$

$$5^4 \mod 9 = 5 \times 8 \mod 9 = 40 \mod 9 = 4$$

$$5^5 \mod 9 = 5 \times 4 \mod 9 = 20 \mod 9 = 2$$

$$5^6 \mod 9 = 5 \times 2 \mod 9 = 10 \mod 9 = 1$$

$$5^7 \mod 9 = 5 \times 1 \mod 9 = 5 \mod 9 = 5$$

Can you see you can use this pattern to find $$(5^{1976}) \mod 9$$ ?