Suppose that $5\leq q\leq p$ are both prime. Prove that $24|(p^2-q^2)$. [duplicate]

Solution 1:

Note that since both $p,q\geq 5$ are primes, they cannot be divisible by $3$, so $p^2\equiv q^2\equiv 1\pmod{3}$, which implies that $3|p^2-q^2$.

Similarly, all odd squares are congruent to $1$ modulo $8$, so $8|p^2-q^2$ as well.

Putting these two facts together, it follows that $24|p^2-q^2$.

Solution 2:

$p+q$ and $p-q$ are even numbers and their sum is not divisible by $4$. Hence one of $p+q$ and $p-q$ is divisible by $4$. For divisibility by $3$ you can assume the contrary: in that case their sum $2p$ or their difference $2q$ would be divisible by $3$.

Solution 3:

Here is a pedestrian solution.

You can prove even more stronger result: $24|p^2-1$ for any prime $p>5$. Indeed, consider three consecutive numbers $p-1, p, p+1$. Since $p$ is odd, then $p-1$ and $p+1$ are consecutive even numbers. Furthermore one of them divisible by $4$. Therefore, $p^2-1=(p-1)(p+1)$ is divisible by $2\cdot 4=8$. Since $p-1, p, p+1$ are three consecutive numbers and $p$ is prime then either $p-1$ or $p+1$ is divisible by $3$. Hence $p^2-1$ is divisible by $3\cdot 8=24$.

Finally, $24|p^2-q^2$ for primes $q\geq p>5$ because of previous lemma and the equality $p^2-q^2=(p^2-1)-(q^2-1)$.