Solution (source code)

= Solution

For distinct <odd primes> $p,q$, <quadratic reciprocity> states
$$
\boxed{\left(\frac pq\right)\left(\frac qp\right)=(-1)^{(p-1)(q-1)/4}.}
$$
Here the <Legendre symbol> records whether a nonzero <congruence class> is a <quadratic residue>. The <first supplementary law for quadratic reciprocity> and <second supplementary law for quadratic reciprocity> give
$$
\left(\frac{-1}p\right)=(-1)^{(p-1)/2},\qquad
\left(\frac2p\right)=(-1)^{(p^2-1)/8}.
$$
Thus \b[minus one is a square exactly when $p\equiv1\pmod4$, and two is a square exactly when $p\equiv1$ or $7\pmod8$].

To test the specified <congruence class>, factor $111=3\cdot37$. Since $2017\equiv1\pmod4$, <multiplicativity of the Legendre symbol> and <quadratic reciprocity> yield
$$
\begin{aligned}
\left(\frac{111}{2017}\right)
&=\left(\frac3{2017}\right)\left(\frac{37}{2017}\right)
=\left(\frac{2017}3\right)\left(\frac{2017}{37}\right)\\
&=\left(\frac13\right)\left(\frac{19}{37}\right)
=\left(\frac{37}{19}\right)
=\left(\frac{18}{19}\right).
\end{aligned}
$$
There is no sign change on swapping $19$ and $37$ because $37\equiv1\pmod4$. Finally $18=2\cdot3^2$, so <multiplicativity of the Legendre symbol> gives $(18/19)=(2/19)=-1$, since $19\equiv3\pmod8$. Therefore
$$
\boxed{x^2\equiv111\pmod{2017}\text{ has no integer solution}.}
$$