$P$ is a prime number not equal to $2$ or $3$. Show that $p - 6$ is a quadratic residue $\pmod p$ whenever... $P$ is a prime number not equal to $2$ or $3$. 
Show that $p - 6$ is a quadratic residue $\pmod p$ whenever $p \equiv 1, 5, 7, 11\pmod {24}$
And show that $p - 6$ is a quadratic non - residue $\pmod p$ whenever $p\equiv 13, 17, 19, 23\pmod {24}$
I know that $p - 6$ is a quadratic residue if there exists a $b$ such that $p - 6\equiv b^2\pmod p$
So for $p = 11$ we get $11 - 6\equiv b^2\pmod {11}$ and $b = 4$ satisfies this.
Similarly, 
For $p = 1$ : $b = 0$
For $p = 5$ : $b = 2$
For $p = 7$ : $b = 1$
And for the quadratic non - residue:
Take $p = 13$ then we see that none of $1^2,  2^2,  3^2, \ldots, 12^2$ are congruent to $13 - 6 = 7 \pmod {13}$. So it is a quadratic non - residue. This is also the case for $17,  19,  23$. 
What I do not understand is: Where does the number $24$ come from? And how do I use it in the explanation above,  or is this not necessary?
 A: I.e. prove: if $p\ge 5$, then $\left(\frac{-6}{p}\right)=1\iff p\equiv \{1,5,7,11\}\pmod{24}$. Use Quadratic Reciprocity.
$$\left(\frac{-6}{p}\right)=\left(\frac{-1}{p}\right)\left(\frac{2}{p}\right)\left(\frac{3}{p}\right)=1$$
$$\iff \begin{cases}\begin{cases}p\equiv 1\pmod{4}\\p\equiv \pm 1\pmod{8}\\p\equiv \pm 1\pmod{12}\end{cases}\\\text{or}\\\begin{cases}p\equiv 1\pmod{4}\\p\equiv \{3,5\}\pmod{8}\\p\equiv \pm 5\pmod{12}\end{cases}\\\text{or}\\\begin{cases}p\equiv 3\pmod{4}\\p\equiv \{3,5\}\pmod{8}\\p\equiv \pm 1\pmod{12}\end{cases}\\\text{or}\\\begin{cases}p\equiv 3\pmod{4}\\p\equiv \pm 1\pmod{8}\\p\equiv \pm 5\pmod{12}\end{cases}\end{cases}$$
A: A short reason for the 24 is this: if $p \equiv 1,7 \pmod {24},$ then we always have an expression
$$ p = u^2 + 6 v^2 $$
in integers.
If $p \equiv 5,11 \pmod {24},$ then we always have an expression
$$ p = 2 r^2 + 3 s^2 $$
in integers.
When we have a quadratic form,
$$ f(x,y) = A x^2 + B xy + C y^2, $$
the discriminant, familiar from the quadratic formula, is
$$ \Delta = B^2 - 4 A C. $$
In the two earlier forms, $\Delta = -24.$
