# Why is this statement a corollary of Fermat's little theorem?

I know that if $p$ prime and $p\nmid a$, then $a^{p-1}\equiv 1\pmod p$ and I know also that $a^{p}\equiv a \pmod p$ using the fact $a\equiv a \pmod p$ and multiplying the members.

What I couldn't understand is why in the Fermat little theorem we have $a^{p}\equiv a \pmod p$ for all integer $a$.

-
I don't understand your question properly. –  rah4927 May 1 at 5:40
If $p$ divides $a$ then both $a^p$ and $a$ are congruent to $0$. –  André Nicolas May 1 at 5:42
@AndréNicolas of course!!! thanks –  user42912 May 1 at 5:43
You already know the result for coprime p and a. If $p|a$ , $a^p\equiv 0\pmod p$ and since $0\equiv a\pmod p$, and the claim follows. –  rah4927 May 1 at 5:44
@user42912: You are welcome. Sometimes "too easy" can be hard to see, we look for something fancy. –  André Nicolas May 1 at 5:46

If $p$ divides $a$ then both $a^p$ and $a$ are congruent to $0$, so $a^p\equiv a\pmod{p}$ holds trivially.

Remark: From $a^p\equiv a\pmod{p}$, we can conversely derive the more common form of Fermat's Theorem. For if $a^p\equiv a\pmod p$, then $p$ divides $a(a^{p-1}-1)$. So if $p$ does not divide $a$, then $p$ divides $a^{p-1}-1$.

-

Either $p$ divides $a$ or $p\nmid a$

As $p$ is prime $p\nmid a\implies (a,p)=1$

As $\displaystyle a^p-a=a(a^{p-1}-1)$

This will be divisible by $p$ if $p|a$

otherwise it will also be divisible by $p$ as $p|(a^{p-1}-1)$ by Fermat little theorem

-

Following the comments of André Nicholas:

If $a\mid p$, then $a\equiv 0 \pmod p$, then multiplying $p$ times both sides we have $a^p\equiv 0 \pmod p$. Thus we have $a\equiv 0 \pmod p$ and $0\equiv a^p\pmod p$ by symmetry, then finally by transitivity:

$$a\equiv a^p \pmod p$$

-
I suppose you meant to say $p\mid a$ in the second line? –  awllower Nov 11 at 14:08