5

Can we prove that every prime larger than $3$ gives a remainder of $1$ or $5$ if divided by $6$ and if so, which formulas can be used while proving?

barak manos
  • 43,109
A.D
  • 77

4 Answers4

12

HINT:

Every positive integer can be written as $$6n,6n\pm1,6n\pm2=2(3n\pm1),6n+3=3(2n+1)$$

11

Yes:

  • $N \equiv 0 \pmod 6 \implies N$ is divisible by $6 \implies$ $N$ is not a prime
  • $N \equiv 2 \pmod 6 \implies N$ is divisible by $2 \implies$ $N$ is not a prime (or $N=2$)
  • $N \equiv 3 \pmod 6 \implies N$ is divisible by $3 \implies$ $N$ is not a prime (or $N=3$)
  • $N \equiv 4 \pmod 6 \implies N$ is divisible by $2$ and $N\geq4 \implies$ $N$ is not a prime
  • $N$ is a prime larger than $3 \implies N \not\equiv 0,2,3,4 \pmod 6 \implies N \equiv 1,5 \pmod 6$
barak manos
  • 43,109
  • Thank you! It is useful for me. – A.D Apr 16 '14 at 16:29
  • @A.D: You're welcome. – barak manos Apr 16 '14 at 16:29
  • That's one heck of an optimization and one, nice, simple, proof for those of us that are not mathematicians. This works an incredible performance treat using simple integer math in SQL. Here's the link where a friend of mine used that optimization. https://www.sqlservercentral.com/forums/topic/calculating-prime-numbers-with-one-query/page/5#post-4215596 – Jeff Moden Jun 21 '23 at 23:54
3

Hint $ $ By Euclid $\ (n,\,6) = (n\ {\rm mod}\ 6,\,6).\,$ Yours is special case $\,(n,6)=1,\,$ e.g. prime $\,n>3.$

So integers coprime to $\,6\,$ have residues (mod $6)\,$ that are coprime to $\,6,\,$ i.e. $\,1$ or $\,5\pmod{\! 6}.$

Generally if $\,n\,$ is coprime to $\,m\,$ then so too is its remainder $\,n\bmod m,\,$ so the remainder must be one of the $\phi(m)$ residues coprime to $m$, because the gcd remains unchanged upon applying a single descent step of the Euclidean algorithm for the gcd (proved in the prior linked post). In the OP we have $\,\phi(2\cdot 3) = 1\cdot 2$.

Bill Dubuque
  • 272,048
0

A proof without word : $\begin{bmatrix} 0 & \textbf1 & 2 & 3 & 4 & \textbf5 \\ 6 & 7 & 8 & 9 & 10 & 11 \\ 12 & 13 & 14 & 15 & 16 & 17 \\ 18& 19 & 20 & 21 & 22 & 23\\ 24 & \color{red}{25} & 26 & 27 & 28 & 29\\ 30 & 31 & 32 & 33 & 34 & \color{red}{35} \\ 36& 37 & 38 & 39 & 40& 41 \\ 42& 43 & 44& 45 & 46 & 47 \\ 48& \color{red}{49} & 50 & 51& 52 & 53 \\ 54& \color{red}{55}&56 &57 & 58 & 59\\..&..&..&..&..&.. \end{bmatrix}$

Stéphane Jaouen
  • 2,954
  • 5
  • 21