Solution (source code)

= Solution

For distinct odd <prime numbers> $p,q$, the law of <quadratic reciprocity> is
$$
\boxed{\left(\frac pq\right)\left(\frac qp\right)=(-1)^{(p-1)(q-1)/4}.}
$$
Thus the two <Legendre symbols> agree unless both <prime numbers> are congruent to $3$ modulo $4$, in which case they have opposite signs.