# A question on primes and divisibility

The question goes as follows:

Prove that for any prime $p\geq 5$, $p^2-1$ will be divisible by $12$.

I think I have a solution but I just wanted to double check with you guys.

My attempt:

If $p$ is a prime greater than $5$ we know $p$ must be odd. Thus it must be the case that both $(p-1)$ and $(p+1)$ are even. Since $p^2-1=(p-1)(p+1)$ we can see that $p^2-1$ must be divisible by 4.

Further, if $p$ is prime it cannot be divisible by $3$, but since $(p-1), p, (p+1)$ are consecutive, it must be the case that either $(p-1)$ or $(p+1)$ is divisible by 3.

Therefore $p^2-1$ is divisible by $3$ and $4$ and hence $12$.

Is this correct logic? And is there a better way? Thanks!

-
It's correct logic, and I don't know any way that would be "better" in an objective way (if specific techniques should be illustrated, some other method may be better for that). Note that if you look a bit closer, you can see that you actually even have $p^2 \equiv 1 \pmod{24}$. –  Daniel Fischer Oct 21 '13 at 13:50
What lets you conclude, if it is divisible by $3$ and $4$ that it is divisible by $12$? It's true, but always good to know why it is true... –  Thomas Andrews Oct 21 '13 at 13:57
–  lab bhattacharjee Oct 21 '13 at 15:13

Another way to approach this question is to begin with $2$ and $3$ and consider the other primes in light of those:

Of the numbers $6n,6n+1,6n+2,6n+3,6n+4,6n+5$ only $6n+1,6n+5$ Are not divisible by either $2$ or $3$, and thus these two forms of numbers are the only possible candidates for primes greater than $3$. In fact, for $n\in\mathbb N$ we can write these as $6n\pm 1$. Then we have:

$$(6n-1)^2-1=36n^2-12n+1-1$$

and

$$(6n+1)^2-1=36n^2+12n+1-1$$

Each of these is clearly divisible by $12$. It may or may not be a simpler way of considering these terms, but it is an alternate way of reaching the same result.

What happens if you extend this method and consider the primes in the sequences $12n+k$?

-