The ring $ℤ/nℤ$ is a field if and only if $n$ is prime
Solution 1:
If $n$ is prime and $\overline a\ne0$ so $a$ isn't a multiple of $n$ and then $a$ and $n$ are coprime so by the Bezout theorem there's $b,c\in\mathbb Z$ such that $$ba+cn=1$$ hence by passing to the class we find $\overline a\overline b=\overline1$.
Conversely if $n$ isn't prime then we write $n=ab$ so $\overline0=\overline a\overline b$ where $\overline a\neq \overline0 $ and $\overline b\neq 0$ hence $\mathbb Z/n\mathbb Z$ isn't an integral domain and then it isn't a field.
Solution 2:
Hints: If $p \not\mid a$ then $ak \operatorname{mod} p$ are different for $k=0, \ldots, p-1$. If $n$ is not prime, then $n=mk$ with $2\le m,k \le n-1$.
Solution 3:
Just for basic idea :
See that , In $\mathbb{Z}_4$, element $\bar{2}$ does not have inverse.
See that , In $\mathbb{Z}_6$ the element $\bar{2}$ and $\bar{3}$ does not have inverse.
See that , In $\mathbb{Z}_8$ the element $\bar{2}$ and $\bar{4}$ does not have inverse.
In general In $\mathbb{Z}_{pq}$ elements $\bar{p}$ and $\bar{q}$ does not have inverse.
Suppose $n$ is prime and let $\bar{a} \in \mathbb{Z}_n$
Consider $\{ \bar{a}.\bar{b} : \bar{b}\in \mathbb{Z}_n\}$.
please check that this can not be a proper subset of $\mathbb{Z}_n$
(You are supposed to use that $n$ is prime to prove above result).
As $\{ \bar{a}.\bar{b} : \bar{b}\in \mathbb{Z}_n\}= \mathbb{Z}_n$, we see that :
for some $\bar{b}\in \mathbb{Z}_n$ we have $\bar{a}. \bar{b}=\bar{1}$ and thus we are done.
Solution 4:
Hint: For prime implies field, use the fact that there are no zero divisors and the pigeonhole principle to argue there must be such a $\overline b$