What is the remainder when $2^{2018}$ is divided by $43$?
I know that this has something to do with one of Fermat's Theorems. I am almost at a loss as to how to solve for the remainder or why it has anything to do with Fermat's Theorem
Here is Fermat's Theorem:
If $p$ is prime and $a$ is not divisible by $p$, then $$a^{p-1}\equiv 1( \text{mod }p)$$ If $a$ is divisible by $p$, then $$a^{p}\equiv a(\text{mod } p) $$
Is $43$ a prime? Yes.
Is $2$ divisible by $43$? No.
By Fermat's little theorem $2^{42} \equiv 1 \pmod {43}$.
Notice $2018$ is close to $2100$, we find $2018 = 2100 - 84 + 2 = 48*42+2$, so $$2^{2018} = 2^{48(42)+2} = (2^{42})^{48} 4 \equiv 1^{48} 4 \equiv 4 \pmod {43}$$
All these can be done in one's head.