# How would you find the last two digits of a number??

#### eChung00

How would you find the last two digits of the sum of two numbers??
$$\displaystyle 3^{402}$$ + $$\displaystyle 7^{81}$$
Thanks!!

#### The Chaz

Forum Staff
You would work modulo 100.

3^2 = 9
3^4 = 81
3^5 = 243 == 43 (mod 100). I will not write "(mod 100)" anymore, but it is implied by my use of "=="

Again,
3^5 == 43
Etc.
There are efficient ways to do it.
e.g. The exponent 402 is 110010010 in binary, so it equals 256 + 128 + 16 + 2
3^2 = 9
3^4 = 81
3^8 = 6561 == 61
3^16 = (3^8)^2 == 61^2 = 3721 == 21
Etc until you get to 3^256
Add up the results of 3^(256 + 128 + 16 + 2)

#### CRGreathouse

Forum Staff
Judging by the problem I guess you've seen the phi function before. If so, you should know that a^phi(n) = 1 (mod n) whenever a and n are coprime, so you can reduce the exponents mod phi(100) = 40.

#### soroban

Math Team
Hello, eChung00!

$$\displaystyle \text{How would you find the last two digits of this}\text{ sum? }\:3^{402}\,+\,7^{81}$$

Note the last two digits of powers-of-3.

. . $$\displaystyle \begin{array}{ccc} 3^1 \;\to\; 03 \\ \\ 3^2 \;\to\; 09 \\ \\ 3^3 \;\to\; 27 \\ \\ 3^4 \;\to\; 81 \\ \\ 3^5 \;\to\; 43 \\ \\ \\ \;.\;\;\;\;\;\;\;\;. \\ \;.\;\;\;\;\;\;\;\;. \\ \;.\;\;\;\;\;\;\;\;. \\ \\ 3^{10} \: \to\:49 \\ \\ \;.\;\;\;\;\;\;\;\;. \\ \;.\;\;\;\;\;\;\;\;. \\ \;.\;\;\;\;\;\;\;\;. \\ \\ 3^{20}\:\to\:01 \end{array}$$

$$\displaystyle \text{Hence: }\:3^{402} \:=\:3^{20\cdot20\,+\,2} \:=\3^{20})^{20}\,\cdot\,3^2 \:\equiv\:1^{20}\,\cdot\,09\text{ (mod 100)}$$

$$\displaystyle \text{That is, }3^{402}\text{ ends in }09.$$

$$\displaystyle \text{Note the last two digits of powers-of-7.}$$

. . $$\displaystyle \begin{array}{ccc}7^1 \;\to\;07 \\ \\ 7^2 \;\to\;49 \\ \\ 7^3 \;\to\;43 \\ \\ 7^4 \;\to\;01 \end{array}$$

$$\displaystyle \text{Hence: }\:7^{81} \:=\:7^{4\cdot20\,+\,1} \:=\7^4)^{20}\,\cdot\,7^1 \:\equiv\: 1^{20}\,\cdot\,7\text{ (mod 100)}$$

$$\displaystyle \text{That is, }7^{81}\text{ ends in }07$$

$$\displaystyle \text{Therefore, }3^{402}\,+\,7^{81}\text{ ends in }\,09\,+\,07 \:=\:16$$

#### eChung00

Thank you very much!!