Let $p > 3$ be a prime for which there exists $x, y \in \mathbb{Z}$ such that $p = x^2 - 6y^2$.
Show that $p \equiv 1 \ or \ 19 \mod{24}$.
The fact that $p = x^2 - 6y^2$ implies that $\left(\frac{6}{p}\right) = 1$ (Legendre symbol) and therefore $p \equiv 1, 5, 19, 23 \bmod{24}$, but I don't know how to continue.
If you know that $p \equiv 1,5,19,23 \pmod{24}$ are your only options you can exclude 5 and 23 by looking at the equation modulo 3. Since $3 \nmid x$ you have $x \equiv \pm 1 \pmod 3$ and thus $p \equiv x^2 \equiv 1 \pmod 3$.