Find the last three digits of $2^{2017}$
My approach:
As $125 \times 8=1000$ we have the congruence modulo $$x \equiv 2^{2017}(mod \: 1000)$$ is equivalent to the equations $$x \equiv 2^{2017}(mod \:125) \tag{1}$$ and $$x \equiv 2^{2017}(mod\:8) \tag{2}$$
Clearly from $(2)$ $x=8m$
Now we need to find remainder when $2^{2017}$ is divided by $125$
We have:
$$2^7 \equiv 3(mod \:125)$$
so $$2^{49} \equiv 3^7(mod \:125)\equiv -63(mod \:125)$$
Hence $$2^{50}\equiv -1(mod \:125) \tag{3}$$
From $(3)$ how to find remainder when $2^{2017}$ is divided by $125$?