# Checking the remainder of $40^{1999}$ divided by $7$

I have been learning some applications to Fermat's Little theorem and I am currently solving the remainder of $40^{1999}$ divided by $7$ and would appreciate if anyone could confirm my answer of $5$.

$7$ is prime and $7\nmid 40$

So according to Fermat's Little Theorem

$40^{6} \equiv 1 \pmod{7}$

$1999/6 = 333\times 6 + 1$

Therefore $(40^6)^{333}\times 40^1 \equiv 1^{333}\times 40 \pmod{7}$

$40^{1999} \equiv 40 \pmod{7}$

$40^{1999} \equiv 5 \pmod{7}$

The remainder of $40^{1999}$ divided by $7$ is $5$

• This is correct. – lulu Jun 18 '17 at 9:48
• You understand correctly. Good job. – fleablood Jun 18 '17 at 16:49

Your reasoning is correct, but you could have used from the start the fact that $40\equiv 5\pmod7$. It follows from this that $40^{1999}\equiv5^{1999}\pmod7$.