It is confusing for students regarding the two forms of the Fermat’s Little Theorem (which is the generalization of the ancient Chinese Remainder Theorem):
General: For any number a
$latex boxed { a^p equiv a mod p, forall a}$
We get,
$latex a^{p} – a equiv 0 mod p$
$latex a. (a^{(p-1)} -1) equiv 0 mod p$
$latex p mid a.(a^{(p-1)} -1)$
If (a, p) co-prime, or g.c.d.(a, p)=1,
then p cannot divide a,
thus
$latex p mid (a^{(p-1)} -1)$
$latex a^{(p-1)} -1 equiv 0 mod p$
Special: g.c.d. (a, p)=1
$latex boxed {a^{(p-1)} equiv 1 mod p, forall a text { co-prime p}}$