Solution (source code)

= Solution

For distinct odd primes,
$$
\boxed{\left(\frac pq\right)\left(\frac qp\right)=(-1)^{(p-1)(q-1)/4}.}
$$
Equivalently the two Legendre symbols agree unless both primes are three modulo four, in which case their signs are opposite. Neither symbol is zero here.