Find the condition on $p$ such that equation $x^2+3 \equiv 0 \pmod{4p^2}$ has roots 
Problem: Find the condition on $p$ such that equation $x^2+3 \equiv 0 \mod 4p^2$ has roots with $p$ is a prime and find the number of roots of this equation.

My solution: $x^2+3 \equiv 0 \mod 4p^2 \Rightarrow x^2 \equiv -3 \mod 4p^2 \Rightarrow x^{4p^2-1} \equiv (-3)^{(4p^2-1)/2}$. By little Fermat theorem we have $x^{4p^2-1} \equiv 1 \mod 4p^2 \Rightarrow (-3)^{(4p^2-1)/2} = 1$. I didn't knew how to continue.
Please give some hint, I'm not sure it right, I think there some doubt in my solution. Thank all!
 A: Here we go. I leave the $p=2$ case to you, and will assume $p>2$.
Now, $x^2+3\equiv 0\pmod{4p^2}$ if and only if $x^2\equiv 1\pmod{4}$ and $x^2\equiv -3\pmod{p^2}$. For the former, it suffices to have $x$ to be odd, that is, $x\equiv 1\pmod{2}$.
Now, we turn our attention to the latter. If $p=3$, observe that we don't get a solution. Hence, $p>3$. Now, $-3$ is a quadratic residue modulo $p$. It is well-known that this holds if and only if $p\equiv 1\pmod{6}$. Now, you want more, you want modulo $p^2$. I'll show that, there is a $q$ such that $q^2+3\equiv 0\pmod{p^2}$ (and note that, there are precisely two values of $q$,  $q$ and $p^2-q$). To see this, let us first suppose $q_0^2+3\equiv 0\pmod{p}$, and $0<q_0<p$. Now, consider the numbers, $a_\ell=q_0+\ell p$, where $\ell$ is to be determined.  You get $a_\ell^2+3 = q_0^2+3+2q_0\ell p + p^2\equiv q_0^2+3+2q_0\ell p\pmod{p^2}$. Let $q_0^2+3=kp$ for some $k$. Then, $a_\ell^2+3 = p(k+2q_0\ell)$. In particular, you want to ensure, $p\mid k+2q_0\ell$. Since $q_0$ and $k$ are fixed, it follows that $\ell\equiv -k(2q_0)^{-1}\pmod{p}$ (and these lines also justify the uniqueness up to a sign flip).
We are done.
