# Finding last digits

Find the last digit and last two digits of an integer. For finding the last digit of $$7^{99}$$ using Euler's theorem we have for integer $$7$$ and $$10$$
$$7^4 \equiv 1 \pmod {10}$$. Since the last digit is the remainder when divided by $$10$$, it gives the answer $$7^{99} \equiv 1 \pmod {10}$$ and the last digit is $$3$$.

But for finding last two digits we have to find the remainder when the number $$7^{100}$$ is divided by $$100$$. By Euler's theorem $$7^{99}\equiv 1 \pmod{100}$$ Now $$7^{100}=7^{99}\cdot 7 \equiv 7 \pmod {10}$$ So the last two digit is $$07$$.

Did I make any mistake? Please tell.

• By Euler's theorem, $7^{40} \equiv 1 \pmod{100}.$ Where did $99$ come from? You used $4$, rather than $9$ in the first problem, so it's odd that you made this mistake in the second problem. Jun 28, 2018 at 15:39
• @B.Goddard thanks I couldn't find it Jun 28, 2018 at 15:42

You are right when you state that $$7^4\equiv1\pmod{10}$$. Actually, $$7^4\equiv1\pmod{100}$$. Therefore, $$7^{99}\equiv7^3\pmod{100}$$. And $$7^3\equiv43\pmod{100}$$. Therefore, the answer is $$43$$.
Concerning your approach, note that what Euler's theorem tells us is that $$7^{40}\equiv1\pmod{100}$$.
Euler's $\phi(100)=40$, not $99$, since $100$ is not prime. You might also look at the Carmichael function $\lambda(100)=20$, which is (with a small variation) the result of applying Euler to the component prime powers of a composite number, and combining via $\text{lcm}$, giving you the largest multiplicative order possible under that modulus and the value which all orders divide. This gives $7^{20}\equiv 1$ and thus $7^{100}\equiv 1 \bmod 100$ directly (last two digits $01$).
This means that $7^{99}\equiv 7^{-1} \bmod 100$ and either we can check the powers of $7$, either directly$\bmod 100$ or through the components of $4$ and $25$ and combine, or we can find the inverse through the extended Euclidean algorithm. In this case we could probably "notice" that $7^2=49$ and use the repetition of squares $\bmod 4n$ to get $7^4(\equiv 49^2\equiv 99^2\equiv -1^2)\equiv 1\bmod 100$ as observed by others, and thus $7^{-1}\equiv 7^3\equiv 43\bmod 100.$