# Show that every prime $p>3$ is either of the form $6n+1$ or of the form $6n+5$

Show that every prime $p>3$ is either of the form $6n+1$ or of the form $6n+5$, where $n=0,1,2, \dots$

#### Solutions Collecting From Web of "Show that every prime $p>3$ is either of the form $6n+1$ or of the form $6n+5$"

Every integer is of the form $6n$ or $6n+1$ or $6n+2$ or $6n+3$ or $6n+4$ or $6n+5$ for some integer $n$. This is because when we divide an integer $m$ by $6$, we get a remainder of $0$, $1$, $2$, $3$, $4$, or $5$.

If an integer $m>2$ is of the form $6n$ or $6n+2$ or $6n+4$, then $m$ is even and greater than $2$, and therefore $m$ is not prime.

If an integer $m>3$ is of the form $6n+3$, then $m$ is divisible by $3$ and greater than $3$, and therefore $m$ is not prime.

We have shown that an integer $m>3$ of the form $6n$ or $6n+2$ or $6n+3$ or $6n+4$ cannot be prime. That leaves as the only candidates for primality greater than $3$ integers of the form $6n+1$ and $6n+5$.

Comment: In fact, it turns out that there are infinitely many primes of the form $6n+1$, and infinitely many primes of the form $6n+5$. Showing that there are infinitely many of the form $6n+5$ is quite easy, it is a small variant of the “Euclid” proof that there are infinitely many primes. Showing that there are infinitely many primes of the form $6n+1$ requires more machinery. But your question did not ask for such a proof.

$6$ divides $6n$, $2$ divides $6n+2$, $3$ divides $6n+3$, $2$ divides $6n+4$, and there are no other cases.

This is elementary algebra. For what value(s) of $n$ is $6n$ prime? $6n+2$? $6n+3$? $6n+4$? Are there any other possibilities besides these and the two that you already mentioned?

Indeed, all primes greater than $3$ are in the form of $6n-1$ and $6n+1$. I’ve studied this a few years ago. Here’s a basic visual proof of that using a sieve and isolation method that I used:

First, list down all the numbers in 6 columns:

$$\begin{array}{c|c|c|c|c|c} 1&2&3&4&5&6\\ 7&8&9&10&11&12\\ 13&14&15&16&17&18\\ \end{array}$$(the list will be infinite)

Then, we cross out the column of $2, 3, 4$, and $6$ as they are all composite. so we are just left out with two columns of $1$ and $5$. Using Algebraic progression with a difference of $6$, Column 1 generates the prime path of $$6n+1\quad[7,13,19,\ldots,\infty]$$ and column 5 generates the prime path of $$6n-1\quad[5,11,17,23,\ldots,\infty]$$

Thus, by isolation and sieve method, we can see that all primes must be in the form $6n-1$/$6n+1$.

Copied from Are all primes (past 2 and 3) of the forms 6n+1 and 6n-1?

[Considering] $n = 6q + r$

where q is a non-negative integer and the remainder $r$ is one of $0, 1, 2, 3, 4$, or $5$.

• If the remainder is $0, 2$ or $4$, then the number $n$ is divisible by $2$, and can not be prime.
• If the remainder is $3$, then the number $n$ is divisible by $3$, and can not be prime.

So if n is prime, then the remainder r is either

• $1$ (and $n = 6q + 1$ is one more than a multiple of six), or
• $5$ (and $n = 6q + 5 = 6(q+1) – 1$ is one less than a multiple of six).