# prove that $[5, 7, 11, 13, 17, 19, 23]$ are the only possible variants of the remainders (read context) when dividing the prime number $p$ by 24 [duplicate]

This question already has an answer here:

The problem is following:

Given that $$p$$ is a prime number, $$p > 3$$. Prove that $$(p^2 - 1)$$ is divisible by $$24$$.

I started writing down the possible remainders of dividing $$p$$ by $$24$$ and got the following row: $${5; 7; 11; 13; 17; 19; 23}$$

But am i even right at this point? If i am how do i prove that these are the only possible remainders?

## marked as duplicate by Jyrki Lahtonen, Community♦Oct 14 at 18:58

You have missed that $$1$$ can be a remainder too (take $$p=73$$ or $$p=97$$, for instance). All other elements of $$\{0,1,2,\ldots,23\}$$ are muliples of $$2$$ or of $$3$$. Since $$p$$ is prime and $$24$$ is a multiple of both $$2$$ and $$3$$, no such number can be the remainder of the division of $$p$$ by $$24$$, since that would make $$p$$ a multiple of $$2$$ or of $$3$$.