Solution (source code)

= Solution

A form $ax^2+bxy+cy^2$ is positive definite when $a>0$ and $d=b^2-4ac<0$; equivalence is change by $SL_2(\mathbb Z)$, and reduced means $|b|\le a\le c$ with the standard boundary sign convention. Translating $x\mapsto x+my$ reduces $|b|$, and swapping variables reduces $a$; discriminant bounds force termination. For a reduced form, $|b|\le a\le\sqrt{|d|/3}$ and $b\equiv d\pmod2$. Discriminant $-28$ has one primitive reduced class, represented by $x^2+7y^2$. Therefore an odd prime is represented exactly when it splits in $\mathbb Q(\sqrt{-7})$, namely $(p/7)=1$, with the ramified exception $p=7$. Thus $p=7$ or $p\equiv1,9,11,15,23,25\pmod{28}$.