Modulus operation finding value sattisfying given condition Find the minimum value of $p$ such that
$5^p \equiv 1 \pmod p$.
What is the approach to solve such questions?
 A: Little Fermat asserts that if $p $ is prime number, for any number $a$ not divisible by $p$, we have $\;a^{p-1}\equiv 1\mod p$.
The set of congruence classes of integers not divisible by $p$ form a multiplicative group, which has order $p-1$. By Lagrange's theorem, the order of an element $a$ of this group (i.e. the smallest $r$ such that $a^k\equiv 1\mod p$) is a divisor of $p-1$. Hence to find the order of an element you have to test a finite number of values.
In the present case the order of $5$ is a divisor of $18$, i.e. it can be $1$ (irrelevant for trivial reasons), $3,6,9$ or $18$.
We can calculate the powers of $5$ by the fast exponentiation algorithm (‘square and multiply’, which yields the following values:
\begin{alignat*}{3}
5^2&\equiv 6,\\
&&&5^3\equiv6\cdot5=30\equiv -8&&\mod19,\\
5^4&\equiv6^2\equiv -2,&\qquad&\\
&& &5^6\equiv -2\cdot6\equiv 7&&\mod 19,\\
5^8&\equiv4,\\
&&&5^{\color{red}9}\equiv4\cdot 5\equiv \color{red}1&&\mod 19.
\end{alignat*}
Thus $5$ has order 9 mod. 19.
A: The minimal $p$ should be $2$, because $5^2\equiv 25\equiv 1\pmod 2 $.
The first condition for the question that should be satisfied is $p>0$ and $p$ must be an integer, otherwise there is no sense talking about the modular equation.
Since it has shown that $2$ is one possible solution, the proposition that
$p = 2$ is the minimal value satisfying the above equation must be proven.
Now that $p > 0$ and $p$ must be a integer, the number less than $2$ is $1$, the statement that $1$ isn't the minimal value must be proven. 
Here is the prove:
If $p = 1$, $5^p \equiv 5 \equiv 0  \pmod 1$, so one can't be a solution.
Therefore, $2$ is the minimal value for $ p$ to satisfy.
EDIT: By Bernard, it should be p equals to 1 rather than 2. Because when $p = 1$, $1 \equiv 0 \pmod 1$
A: A quick check on an Excel spreadsheet shows that p=9 is the answer.  Just write a little program in any language you have on hand.
