Prove that a prime $p$ can be written as $p=a^2+ab+41b^2$ iff $-163$ is a quadratic residue modulo $p$.
What I have in mind is something like this: look at $\mathbb{Q}[\sqrt{-163}]$ which has the ring of integers $\mathbb{Z} \left [ \dfrac{1+\sqrt{-163}}{2} \right ]$. Now $p$ is of that form iff $p$ is the norm of an element in the ring of integers. It is well known that the ring of intergers in this case is a PID. However, I cannot tie the fact that -163 has to be a quadratic residue to all of this (in one direction, clearly if $p=a^2+ab+41b^2$ then $4p=(2a+b)^2+163b^2$ so $-163$ has to be a quadratic residue). Could somebody help me complete a solution along these lines?
Consider the decomposition of $p$ in $\mathcal{O} = \mathbb{Z} \left[\frac{1+\sqrt{-163}}{2} \right]$.
There exists an ideal in $\mathcal{O}$ of norm $p$ $\Longleftrightarrow$ $p$ splits in $\mathcal{O}$ $\Longleftrightarrow$ $-163$ is a quadratic residue mod $p$.
In fact, (since $p$ is unramified in $\mathcal{O}$), if $p$ is inert in $\mathcal{O}$ then the only ideal of $\mathcal{O}$ above $p$ is $(p)$ itself which is of norm $p^2$, hence there is no ideal of $\mathcal{O}$ of norm $p$.