$\mathbb Z_p^*$ is a group iff $p$ is prime I'm trying to prove  $\mathbb Z_p^*$ is a group if and only if $p$ is prime. I know that if $p$ is prime $\mathbb Z_p^*$ is a group, but how can I do the converse? In another words, if the equation $ax\equiv 1 (\mod m)$ has solution for every integer $a$ which is not divisible by $m$, then $m$ is prime.
I'm trying to solve this exercise:

Thanks 

The equation in $x$ : $ax\equiv 1 \bmod n$ has a solution if and only if $(a,n)=1$. If $n$ is not prime take $a$ a proper divisor of $n$. Then $a$ is not divisible by $n$ , while $ax\equiv 1$ has no solution.
Although note that $\mathbb Z_p^*$ is the group in which the elements are the congruence classes relatively prime to $p$. Not those that are not multiples of $p$.
