If $p=a^2+4b^2$ for some $a,b \in \mathbb{Z}$, then $a$ is quadratic residu modulo $p$?

If $p=a^2+4b^2$ then $p\equiv 1\bmod{4}$ hence $$ \left(\frac{a}{p}\right)=\left(\frac{p}{a}\right)=\left(\frac{p-a^2}{a}\right)=\left(\frac{(2b)^2}{a}\right)=1. $$


We easily see that $p\equiv1\pmod4$, so for any prime factor $q\mid a$ we have, by quadratic reciprocity $$ \left(\frac pq\right)=\left(\frac qp\right). $$ OTOH we have $a^2=p-4b^2$. Therefore $$ p\equiv 4b^2=(2b)^2\pmod q $$ and $\left(\dfrac pq\right)=1$ for all those primes $q$.

So all the prime factors of $a$ are QRs modulo $p$. Therefore so is $a$.