I have to show that every prime $\displaystyle p>5$ can be expressed in the form $\displaystyle p = \sqrt{24n+1}$ with $\displaystyle n$ an integer.

So I figure I need to show that $\displaystyle \frac{(p^2-1)}{{24}}$ is always an integer. If the numerator is divisible by 24 then it must be divisible by $\displaystyle 2^3 = 8$ i.e. divisible by 2 at least three times. How can I show this is true?

My idea is to show that $\displaystyle (p^2-1)$ is always divisible by 8 and 3 but I don't know how to do it. I'm thinking something about the last digit of $\displaystyle p^2$ only taking certain values meaning that $\displaystyle (p^2-1)$ is divisible by 8 but am having difficulty deciding how to do it. Maybe I'm going about this the wrong way.

Any help is appreciated.