<s>[INST] Safe prime mod 24 Given a safe-prime $p = 2q + 1$ where $q$ is also a prime and $p \gt 7$, I've read in a crypto.se answer that either $p \equiv 11 \pmod {24}$ or $p \equiv 23 \pmod {24}$.
I understand the proofs of why $p^2 \equiv 1 \pmod {24}$, and $p \equiv 1 \pmod 6$ or $p \equiv 5 \pmod 6$ for any prime $p$, and I can see that $p \equiv 11 \pmod {24}$ and $p \equiv 23 \pmod {24}$ are consistent with that, but can anyone explain why the other possible congruences for a prime $p$ (such as $p \equiv 1 \pmod {24}$) are excluded by $p$ being a safe prime?
My reasoning so far is:

For a prime $p \equiv 1 \pmod 6$ and  $p \equiv (1,7,13,19) \pmod {24}$, or $p \equiv 5 \pmod 6$ and $p \equiv (5,11,17,23) \pmod {24}$.
For a safe prime $p = 2q + 1$ it cannot be true that $p \equiv 1 \pmod 6$, otherwise $2q$ would be divisible by 6 and $q$ would not be prime. This eliminates 1, 7, 13 and 19.
Likewise $p = 2q+1 \equiv 5 \pmod {24}$ and $p = 2q+1 \equiv 17 \pmod {24}$ cannot hold, otherwise $q$ would have to be even: $q \equiv 2 \pmod {24}$ or $q\equiv 8\pmod {24}$ respectively.
This leaves $p \equiv 11 \pmod {24}$ or $p \equiv 23 \pmod {24}$ as possible congruences.

Is this correct and sufficient, and/or is there a better way of demonstrating that either $p \equiv 11 \pmod {24}$ or $p \equiv 23 \pmod {24}$ can and must hold?
 [/INST] I suggest you change to "otherwise $q$ would have to be even: $q \equiv 2$ or $14 \pmod{24}$, or $q \equiv 8$ or $20\pmod{24}$ respectively."
I would approach it from the other direction, checking candidates for $q$, because multiplication is safer than division in modular atithmetic. There are $12$ odd congruency classes $\pmod{24}$. The four classes $3, 9, 15, 21$ can be discarded as candidates for $q$ because of divisibility by $3$ (apart from the number $3$ itself). Any odd number $\equiv 1 \pmod{6}$ may also be safely discarded, because if $q\equiv 1 \pmod{6}$, then $p = 2q + 1 \equiv 3\pmod 6$. So we discard the four classes $1, 7, 13, 19$ as candidates for $q$. Thus we're left with four candidates for $q$: $5, 11, 17, 23$. In each case $2q + 1 \equiv 11$ or $23\pmod{24}$.
That being said, I would also find it faster, easier and better to work out modulo $12$. $p \equiv 11$ or $23 \pmod{24}$ is exactly the same as saying $p\equiv 11 \pmod{12}$. In this case we only have six odd congruency classes, and four of them are removed by observing that $q \equiv 5 \pmod6$. The remaining two possibilities ($q \equiv 5$ and $q\equiv 11$) both produce $p \equiv 11$.
</s>