Solution (source code)

= Solution

Choose the representative $1\leq a\leq p-1$. Since $p$ is <prime> and does not divide $a$, their <greatest common divisor> is one. The <extended Euclidean algorithm> gives the <Bezout identity>
$$
ax+py=1
$$
for some <integers> $x,y$. Reducing modulo $p$ gives $ax\equiv1\pmod p$, so \b[the residue class of $x$ is a <multiplicative inverse> of $a$]. The argument uses the nonzero condition to exclude the only residue with <greatest common divisor> $p$.