Little Fermats theorem states that
If $n$ is a prime number then $a^n \equiv a \mod{n}$
Equivalently
If $n$ is a prime number and $a$ is not divisible by $n$ then
$a^{n-1} \equiv 1 \mod{n}$
My doubt is
For any natural number $n$ if its correct that
$a^n \equiv a \mod{n}$
Then when i can also write it as
$a^{n-1} \equiv 1\mod{n}$
And when i cant write ?
Thanks in advance ........... :)
If $a$ is not divisible by $p$, you can write $a^{n-1} \equiv 1 \pmod n$, just by dividing both sides by $a$.
If $a$ was divisible by $p$ then $a \pmod p$ would be $0$.