Let $p\neq3$ be a prime conguent to $3\pmod4$ and let $q$ be a prime divisor of $(12p)^{2019}+1$ satisfying $q\equiv p^2+1\pmod{3p}$. Determine $q\pmod 4$.
I tried solving the problem as follows. Since $p\equiv 3\pmod 4$, there exists an integer $n$ such that $p=4n-1$. Since $q\equiv p^2+1\pmod{3p}$, there exists an integer $k$ such that $$q=p^2+1+3kp=16n^2-8n+2+3kp.$$ Therefore, $q\equiv 2+3kp\pmod4$. I do not know how to proceed, and neither how to use the fact that $q\equiv p^2+1\pmod{3p}$. This exercise is from a chapter on the Legendre symbol, introducing the law of quadratic reciprocity.
$p\neq 3$, $p\equiv 3\bmod 4$.
$q\equiv p^2+1\pmod{3p}$ is equivalent to
$$q\equiv p^2+1\pmod{3}\hbox{ and }q\equiv p^2+1\pmod{p}$$ i.e.
$$q\equiv 2\pmod{3}\hbox{ and }q\equiv 1\pmod{p}$$ In particular, you have $\left(\frac{q}{3}\right)=-1$ and $\left(\frac{q}{p}\right)=1$.
Since $q$ divides $(12p)^{2019}+1$. We have that $(12p)^{2019}\equiv -1\bmod{q}$. So $(12p)^{2020}\equiv -12p\bmod{q}$. Which means that $-12p$, and consequently $-3p$, is quadratic residue mod $q$. Hence, we have $$\left(\frac{-3p}{q}\right)=1$$ Therefore $$\left(\frac{-1}{q}\right)\left(\frac{p}{q}\right)\left(\frac{3}{q}\right)=1$$
If $q\equiv 1\bmod 4$ then, $\left(\frac{-1}{q}\right)=1$ and by quadratic reciprocity you have $\left(\frac{p}{q}\right)=\left(\frac{q}{p}\right)=1$ and $\left(\frac{3}{q}\right)=\left(\frac{q}{3}\right)=-1$. Note that this contradicts the previous formula.
Hence we conclude that $q\equiv 3\mod 4$.