Let $n \in \mathbb{N}^{+} \smallsetminus \{{1}\}$ and $p = min\{p \in \mathbb{P} : p \mid n\}$.
Also, let $a \in \mathbb{Z}$ and $a^n \equiv 1 \pmod{n}$
I need to proof, that $a \equiv 1 \pmod{p}$.
It is a study task. Therefore, I wish to get some algorithm of solution of my problem.
Fermat's Little Theorem can be stated as, for any prime $p$ and coprime $a$ we have that $$a^{p-1}=1\pmod p$$ These questions are scattered around. Feel free to read on-line literature on the subject, it is not too hard to find.