Take the 2-minute tour ×
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.

Why is every prime (>3) representable as $6k\pm1$? Afterall, by putting values of k, we don't just get primes but also composites. Then why not $2k+1$ or $3k+2$ or $4k+1$ etc. Is it because of probability? Is there a proof for it?

share|improve this question
    
@user7530- Thanks for pointing out, edited. –  Ramit Dec 23 '13 at 3:43
    
HINT Use modulo. –  Don Larynx Dec 23 '13 at 3:51
    
"Then why not 2k+1 or 3k+2 or 4k+1 etc." You are asking for an explanation behind a false idea. These other forms are also valid for primes and used in practice. –  anon Dec 23 '13 at 4:52

6 Answers 6

up vote 8 down vote accepted

The proposition you're mentioning is this:

If $n \ne 2, 3$ is prime, then there is an integer $k$ such that $n = 6k - 1$ or $n = 6k + 1$.

This is true by showing that all numbers of other forms are not prime:

$$6k = 6 \cdot k$$ $$6k + 2 = 2(3k + 1)$$ $$6k + 3 = 3(2k + 1)$$ $$6k + 4 = 2(3k + 2)$$ It does not say that every number of the form $6k \pm 1$ is prime; this is most certainly false (I think you may have confused the statement with its converse.) We can make analogous statements with $6$ replaced by other numbers:

If $n \ne 2$ is prime, $n$ is of the form $2k + 1$.


If $n \ne 2$ is prime, $n$ is of the form $4k \pm 1$.

and so on.

share|improve this answer
3  
Actually, I wanted to ask why 6k+1 form is more popular than say 2k+1 or 4k+1? While proving any proposition related to primes, we take 6k+1 and nor 4k+1? why? is there a proof? –  Ramit Dec 23 '13 at 3:53
    
@Ramit The fact that all primes $\ne 2$ are odd comes up sometimes. Otherwise, I'm not entirely sure what you mean: Is there a particular proposition that you're thinking of that uses (in a fundamental way) the fact that almost all primes are of the form $6k \pm 1$? –  T. Bongers Dec 23 '13 at 3:56
    
p^2+2 divisible by 3 –  Ramit Dec 23 '13 at 3:57
    
@Ramit In that case, it's useful to use this representation. For other propositions, different representations are more useful. It's just a matter of details and the particular proposition being studied. –  T. Bongers Dec 23 '13 at 4:01
    
ok, I take ur words. thanks. –  Ramit Dec 23 '13 at 4:03

Do you think that every number can be written as $6k+i$ for $0\leq i\leq 5$???

Do you think $6k$ can be prime?

Do you think $6k+2$ can be prime?

Do you think $6k+3$ is prime?

Do you think $6k+4$ is prime?

If you have answered all above....

only possibilities would be writing them as other two possibilities :

$6k+1$ and $6k+5$ which is same as $6k\pm 1$

share|improve this answer
    
but every number can be written in 2k+i form as well, what's special about 6? –  Ramit Dec 23 '13 at 3:56
    
Oh yeah... I just now saw your comment for T.Bongers answer.... I am sure there is no specialty for $6$ It is just for convenience... –  Praphulla Koushik Dec 23 '13 at 3:58
    
I doubt that. I wish there were a proof. –  Ramit Dec 23 '13 at 3:59
    
No... Don't bother about that... –  Praphulla Koushik Dec 23 '13 at 4:01
    
ok :-) great. i won't bother. –  Ramit Dec 23 '13 at 4:03

Suppose $n = 6k+r$, $r\in\{0,2,4\}$. Can you think of any integers that must divide $n$? What does this say about the primality of $n$, for $n$ sufficiently large?

Now what about $n = 6k+3$?

This leaves only $n = 6k\pm 1.$

share|improve this answer
    
This is not what my question is –  Ramit Dec 23 '13 at 3:45
    
@Ramit I'm afraid your question is unclear to me, then. –  user7530 Dec 23 '13 at 3:46

Let me take a crack at the original question:

$$n = a k + b$$ where $a$ and $b$ are constants would be a prime only if $a$ and $b$ don't have a common factors. Now clearly $b = \pm 1$ will always work. Now if you fix $a$, then the count of the numbers that are less than $a$ and co-prime to it is the Euler's totient function $\phi$. Now if $\phi(a)$ is two then there can be only two possible $b$, viz. $1$, $a-1$. Now $6$ is the largest $a$ for which $\phi(a)=2$.

I hope this was the question.

share|improve this answer

Another phrasing for this question coud be, why is it that if we have a prime number $p$, then $p+1$ or $p-1$ is a multiple of $6$?

The way I see it is that, for a number to be a multiple of 6, it has to be a multiple of $3$ and $2$. For $p>3 \ $, $p+1$ and $p-1$ are already multiple of $2$, because they are even. To confirm that they also are multiples of $3$, remember that if we sum the digits of a number and obtain a multiple of $3$, then the original number is a multiple of $3$.

Thus if we sum the digits of $p$, and we repeat the process untill we get $1$ digit, we have $9$ possibilities. The sum is:

1, then substruct $1$ (or add $5$) to get a multiple of $3$

2, then add$1$ (or substruct $5$) to get a multiple of $3$

3, then $p$ wasn't a prime

4, then substruct $1$ (or add $5$) to get a multiple of $3$

5, then add $1$ (or substruct $5$) to get a multiple of $3$

6, then $p$ wasn't a prime

7, then substruct $1$ (or add $5$) to get a multiple of $3$

8, then add $1$ (or substruct $5$) to get a multiple of $3$

9, then $p$ wasn't a prime

share|improve this answer

Afterall, by putting values of k, we don't just get primes but also composites.

You're confusing a statement with its converse. It is not the case that all integers of the form $6k±1$ are prime. But it is the case that all prime numbers except for 2 and 3 have the form $6k±1$.

Why is every prime (>3) representable as 6k±1?

$\forall n \in \mathbb{Z}, n \in \{0, 1, 2, 3, 4, 5\}$ (modulo 6). IOW, all integers must have one of the forms:

  • $n = 6k$ is always composite
  • $n = 6k + 1$
  • $n = 6k + 2 = 2(3k + 1)$ is composite except for $k = 0 \rightarrow n=2$
  • $n = 6k + 3 = 3(2k + 1)$ is composite except for $k = 0 \rightarrow n=3$
  • $n = 6k + 4 = 2(3k + 2)$ is always composite
  • $n =6k + 5$

Thus, with the exception of 2 and 3, all prime numbers are in $\{1, 5\}$ (modulo 6).

Then why not $2k+1$ or $3k+2$ or $4k+1$ etc.

This is the interesting question. There are similar formulas with a modulus other than 6. For example, in the familiar base-ten representation,

  • Integers ending in the digits $\{0, 2, 4, 6, 8\}$ are multiples of 2, and thus not prime (except for 2 itself).
  • Integers ending in the digits $\{0, 5\}$ are multiples of 5, and thus not primt (except for 5 itself).

Therefore, with the exception of $\{2, 5\}$, the prime divisors of 10, all prime numbers have a final digit ($n$ mod $10$) in $\{1, 3, 7, 9\}$.

In general, for any modulus $m$, an integer $p > m$ can be prime only if $p$ mod $m$ is relatively prime to $m$ (but not vice versa). For various values of $m$, the possible values of $p$ mod $m$ are as follows:

  • 2: $\{1\}$
  • 3: $\{1, 2\}$
  • 4: $\{1, 3\}$
  • 5: $\{1, 2, 3, 4\}$
  • 6: $\{1, 5\}$
  • 7: $\{1, 2, 3, 4, 5, 6\}$
  • 8: $\{1, 3, 5, 7\}$
  • 9: $\{1, 2, 4, 5, 7, 8\}$
  • 10: $\{1, 3, 7, 9\}$
  • 11: $\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\}$
  • 12: $\{1, 5, 7, 11\}$
  • 13: $\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12\}$
  • 14: $\{1, 3, 5, 9, 11, 13\}$
  • 15: $\{1, 2, 4, 7, 8, 11, 13, 14\}$
  • 16: $\{1, 3, 5, 7, 9, 11, 13, 15\}$
  • 17: $\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16\}$
  • 18: $\{1, 5, 7, 11, 13, 17\}$
  • 19: $\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18\}$
  • 20: $\{1, 3, 7, 9, 11, 13, 17, 19\}$
  • 21: $\{1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20\}$
  • 22: $\{1, 3, 5, 7, 9, 13, 15, 17, 19, 21\}$
  • 23: $\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22\}$
  • 24: $\{1, 5, 7, 11, 13, 17, 19, 23\}$
  • 25: $\{1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24\}$
  • 26: $\{1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25\}$
  • 27: $\{1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26\}$
  • 28: $\{1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25, 27\}$
  • 29: $\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28\}$
  • 30: $\{1, 7, 11, 13, 17, 19, 23, 29\}$
  • 31: $\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30\}$
  • 32: $\{1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31\}$
  • 33: $\{1, 2, 4, 5, 7, 8, 10, 13, 14, 16, 17, 19, 20, 23, 25, 26, 28, 29, 31, 32\}$
  • 34: $\{1, 3, 5, 7, 9, 11, 13, 15, 19, 21, 23, 25, 27, 29, 31, 33\}$
  • 35: $\{1, 2, 3, 4, 6, 8, 9, 11, 12, 13, 16, 17, 18, 19, 22, 23, 24, 26, 27, 29, 31, 32, 33, 34\}$
  • 36: $\{1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35\}$

So, which modulus should we use in describing the set of prime numbers? It would be helpful to have a simple primality test with as few “false positives” as possible.

For example, $m = 31$ is useless because all it tells us is that no prime number is a multiple of 31 (except for 31 itself). The other $\frac{30}{31}$ of $\mathbb{N}$ (my phrasing may annoy cardinality purists, but you know what I mean) is still potential prime.

OTOH, $m = 2$ gives a useful rule: All prime numbers (except for 2) are odd. This is easy to remember, and excludes $\frac{1}{2}$ of $\mathbb{N}$ (again, being informal with cardinality) from being prime.

But we can do better! If $m$ is 6, 12, 18, 24, or 36, then only $\frac{1}{3}$ of natural numbers are potentially prime. And note that the primality tests for $m \in \{12, 18, 24, 36\}$ are just more complicated ways of expressing the rule for $m = 6$. This gives us a simply-expressed superset of the prime numbers.

$\mathbb{P} \subset \{2, 3\} \cup \{n: n \in \{1, 5\} \mod 6\}$

or, equivalently,

$\mathbb{P} \subset \{2, 3\} \cup \{6k ± 1\}$

That's what's so special about 6.

Now, there are choices for $m$ that give a primality test with fewer false positives. For example, $m=30$ has only $\frac{4}{15}$ of numbers being potentially prime. But the rule is harder to remember.

share|improve this answer
    
Thanks for addressing my question to the fullest. Surely, with 2, one half of N are not prime. I lost you when you said with 6, 1/3rd of N are not prime. Can I seek clarification? –  Ramit Dec 24 '13 at 9:52
    
For any given value of $m$, there are some numbers $n$ that can be trivially shown to be composite based only on the value of $n$ mod $m$ (or equivalently, the last digit when $n$ is written in base $m$). I call all the other natural numbers "potentially prime". For example, in familiar base-ten, the numbers 90, 92, 94, 95, 96, and 98 can be ruled out as prime based solely on their last digit. The numbers 91, 93, 97, and 99 are "potentially prime" based on their last digit, even though 97 is the only one that's really a prime. –  Dan Dec 24 '13 at 20:41
    
This sieve of "potentially prime" numbers will include all the primes (except for a finite number of small primes which are divisors of $m$), but will also include some "false positives" that aren't actually prime. We want the sieve to be as small as possible in order to minimize these "false positives". –  Dan Dec 24 '13 at 20:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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