# What will be the sum of digits after cancellation of all 9s and digits adding upto 9?

I took a number, $2012^{2012}$.

Then I cancelled all the $9$'s which appeared in its expansion. I also cancelled all the digits which added up to $9$ viz $1 + 3 + 5 , 2 + 7$ etc. What will be the sum of remaining digits?

-
–  Ｊ. Ｍ. Jul 7 '12 at 9:32

The answer of your problem is $2012^{2012}\pmod {9}$. Since $2012^{6}=1\pmod 9\implies 2012^{6(335)+2}\pmod 9=2012^2\pmod9=7$. Thus the sum of the remaining digits is $7$.

-

Here's a method for computing $2012^{2012} \bmod 9$ that avoids doing any divisions (with remainder) of "large" numbers. First, modular arithmetic tells us

$$2012^{\displaystyle 2012} \equiv (2012 \bmod 9)^{\displaystyle (2012 \bmod \phi(9))} \equiv (2012 \bmod 9)^{\displaystyle (2012 \bmod 6)} \pmod 9.$$

For $2012 \bmod 9$, you can add the digits to get

$$2012 \equiv 2 + 0 + 1 + 2 \equiv 5 \pmod 9$$

For $2012 \bmod 6$, let us use the Chinese Remainder Theorem on $2012 \bmod 2,3$. Obviously:

$$2012 \equiv 0 \pmod 2.$$

Modulo $3$ you can also add digits to get

$$2012 \equiv 2 + 0 + 1 + 2 \equiv 5 \equiv 2 \pmod 3.$$

Combining them with CRT, you get

$$2012 \equiv 2 \pmod 6.$$

So in total we get

$$2012^{\displaystyle 2012} \equiv 5^2 \equiv 25 \equiv 2 + 5 \equiv 7 \pmod 9.$$

-

We know a≡b(mod m)=>$a^n≡b^n(mod\ m)$

$2012≡5(mod\ 9)$ (as in base n, any natural number (mod n-1) => digit sum(mod n-1))

=>$2012^{2012}≡5^{2012}(mod\ 9)$

Using Euler's Totient theorem, $a^{\phi(m)}≡1(mod\ m)$ where (a.m)=1

=> $a^{b\phi(m)+c}≡a^c(mod\ m)$ where b is any natural number.

$\phi(9)=6$ and 2012=2+6.350

$2012^{2012}≡5^{2012}(mod\ 9)≡5^2(mod\ 9)=7$

-