0

I don't know how it works, although I learn it by myself. I need to find the last three digit number 3^3^3^3.... power of 3 is reapeted 2016 times. First of all, I calculated the Totient function for 1000. φ(1000)=400 after many calculations I've get this

3^187≡? (mod 1000)

Admittedly, I read a few books and article, but I still don't know how to overcome this obstecles.

amWhy
  • 209,954
Werka G
  • 17
  • 1
    https://en.wikipedia.org/wiki/Exponentiation_by_squaring – florence May 23 '17 at 07:47
  • Have you heard about the Chinese remainder theorem? It should shrink the exponent a little. – Arthur May 23 '17 at 08:11
  • See also : https://math.stackexchange.com/questions/362012/find-the-last-two-digits-of-781 and https://math.stackexchange.com/questions/1337375/what-are-the-last-two-digits-of-7717 – lab bhattacharjee May 23 '17 at 09:00

1 Answers1

3

If understand your question, you want to compute the last three digits in base $10$ of $3^{2016}$. To do this, you compute the residue of $3^{2016}$ modulo $1000$, which is fine. By Euler's Theorem, we know that $3^{400} \equiv 1 \;(1000)$, because $\varphi(1000) = 400$, as you pointed out. This gives $$3^{2016} \equiv 3^{5\cdot400 + 16}\equiv 3^{16}\; (1000)$$ Now you only need to compute $3^{16}$ modulo $1000$. You can compute this by hand, after observing that $3^{16} = 9^8 = (1 - 10)^8$ and then using the binomial theorem to expand the last term (you only need to do it up to degree 2): $$3^{16} \equiv (1 - 10)^8 \equiv 1 - 8\cdot 10 + 28 \cdot 10^2 \equiv 721 \; (1000)$$ Hence the answer is $721$.

Volanem
  • 394