Defineas the set of integers mod n:
which is endowed with the operations
and
. It appears that this ring with identity is a field if and only if
is prime. The key is whether or not elements of
have inverses (they don't when
is composite).
So I managed to prove that: ifis not prime, then
has no inverse mod n. Now I am having trouble going the opposite way: how do I show that if
is prime, i.e. -
, then for all
,
has an inverse mod n? Thanks!

