Modulo and Congruence

89 Views Asked by At

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 ........... :)

1

There are 1 best solutions below

5
On BEST ANSWER

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$.