Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

This question already has an answer here:

I was just having an argument with my friend and I dunno how we got here. But he suddenly said all primes are 1 above or below a multiple of 6.

At first I tried a lot of primes but couldn't disprove this. I tried googling but the stuff is too complicated for me.

Is there a simple to understand proof for this statement?

$p \equiv \pm 1 \pmod{6}$, where $p$ is prime.

As pointed out by the answers. I forgot to mention that p > 3. I never checked 2 and 3 when talking to my friend. Somehow thought of them as corner cases.

share|cite|improve this question

marked as duplicate by Antonio Vargas, Normal Human, Hakim, apnorton, Cookie Jul 28 '14 at 0:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5 Answers 5

up vote 10 down vote accepted

If $p$ is a prime >3, then since $p$ is not divisible by 3, we must have $p−1$ or $p+1$ divisible by 3. And both are even, so one must be divisible by 6.

More generally, if you are neither divisible by 2 nor 3, then you neighbor a multiple of 6.

share|cite|improve this answer
This is a very slick proof. Nice. +1. – MPW Jul 27 '14 at 23:45

Given any integer $p > 3$, we know by (a modified version of) the Division Algorithm that there exist unique integers $q \geq 0$ and $r \in \{-1,0,1,2,3,4\}$ such that: $$ p = 6q + r $$ Now suppose that $p$ is prime. Then observe that $r \notin \{0,2,4\}$, since otherwise $p$ would be even (contradicting the fact that $p \neq 2$).

Likewise, observe that $r \neq 3$, since otherwise $p = 6q + 3$ would be divisible by $3$ (contradicting the fact that $p \neq 3$).

So $r = \pm 1$, as desired. $~~\blacksquare$

share|cite|improve this answer
so in fact we've proven something stronger than what was asked – JC574 Jul 27 '14 at 23:11
I believe that it's roughly equivalent to what was asked. Note that I had to make an additional assumption that $p > 3$, since $p = 2$ and $p = 3$ serve as counterexamples. – Adriano Jul 27 '14 at 23:12
@Adriano, and $p=2$ and $p=3$ are always factors of $6.$ – Fred Kline Jul 27 '14 at 23:21
yeah, I wasn't seriously pointing anything out haha, but we've proven that any integer not divisible by 2 or 3 is $\pm 1$ modulo 6 haven't we? – JC574 Jul 27 '14 at 23:59

$3$ divide $p^2-1=(p-1)(p+1)$ then $3$ divide $p+1$ or $3$ divide $p-1$ (because $3$ is prime), as $2$ divide $p+1$ and $p-1$, then $6=2\times 3$ divide $p+1$ or $p-1$.

share|cite|improve this answer

Hint $\ $ Primes $>3\,$ are coprime to $\,2,3\,$ so coprime to $\,6.\,$ The integers $\,n\,$ coprime to $6$ are those of form $\,6q\!\color{#c00}{+\!1},\ 6q\!+\!5 = 6(q\!+\!1)\color{#c00}{-\!1},\,$ since $\,2\mid 6q\!+\!r,\ r\in\{0,2,4\},\,$ and $\, 3\mid 6q\!+\!3,\,$ exhausting all possible cases, since, by the Division Algorithm, $\ n = 6q+r\,$ for unique remainder $\, 0\le r \le 5.$

share|cite|improve this answer

First, every number is within a distance six of a multiple of six. Primes bigger than 2 are odd so must be an odd distance from a multiple of six otherwise they would be even. That means primes are a distance of one or three from a multiple of six.

However, multiples of six are divisible by 3, so numbers a distance of three from multiples of six are also divisible by 3. That means that 2 (being even) and 3 are the only primes not a distance of one from a multiple of six. Thus, we conclude, all primes bigger than 4 are plus or minus one from a multiple of six.

share|cite|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.