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}.}
$$
Thus the two symbols agree unless both primes are three modulo four, in which case they have opposite signs.