If $p$ is prime, with $p> 3$, then $p^{2} \equiv1\pmod{24}$ I tried to deny the thesis and show that $p$ is not prime. Like this,
if $24\nmid p^{2}-1$ then $p^{2}-1=24q+r$, $0<r<24$, but it did not look so cool.
 A: First, it's well known that $p^2 \equiv 1 \pmod 8$.  (Try letting $p = 8k + m$ for odd $m$ and compute the binomial expansion of $p^2$.)
Then, since $3 \nmid p$, $p \equiv \pm1 \pmod 3$, which implies $p^2 \equiv 1 \pmod 3$.
Finally, finish this question with Chinese Remainder Theorem: as $\gcd(3,8) = 1$, $p^2 = 1 \pmod{24}$ is equivalent to $p^2 \equiv 1 \pmod 8$ and $p^2 \equiv 1 \pmod 3$.
A: If $p$ is prime and $p>3$ then $p \equiv1\pmod{4}$ or $p \equiv3\pmod{4}$ (otherwise $p$ is an even number, not true because $2$ is the only even prime number).
Because of that, either $n-1$ or $n+1$ is divisible by $4$ (but not both), the other number is also even (divisible by $2$), which implies $(n-1)(n+1)$ or $n^2-1$ is divisible by $8$.
Also if $p$ is prime and $p>3$ then $p$ is not divisible by $3$, so either either $n-1$ or $n+1$ is divisible by $3$ (but not both)$\Rightarrow n^2-1$ is divisible by 3.
Because $GCD(3;8)=1$, $n^2-1$ is divisible by $3 \times 8 =24$. 
A: If $p$ is prime we know that it must have odd residue.
But it can't be $\{3, 9, 15, 21\}$, as $24k  + r$ with one of those is divisible by $3$.
This leaves $\{1, 5, 7, 11, 13, 17, 19, 23\}$, all of which when squared have remainder $1 \bmod 24$.
A: The squares modulo $24$ are $0, 1, 4, 9, 12, 16$. There are no other possible values (see Sloane's OEIS).
If $n^2 \equiv 9 \pmod{24}$, that suggests $n$ is a multiple of $3$, and since you stipulated $p > 3$, this rules out $n = \pm 3$, the only primes divisible by $3$. And $0, 4, 12, 16$ are all even, but since you stipulated $p > 3$, $n = \pm 2$ is also ruled out.
That leaves us with $n^2 \equiv 1 \pmod{24}$. So if $p^2 \not \equiv 0, 4, 9, 12$ or $16$, what can it possibly be?
Look at the squares of a few small primes: $5^2 = 24 + 1$, $7^2 = 2 \times 24 + 1$, $11^2 = 5 \times 24 + 1$, etc.
