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?
-
1You mean "gives a remainder of 1 or 5 if divided by 6". Note that every other remainder (0, 2, 3, or 4) implies that either 2 or 3 will divide the number, so it isn't prime. – hmakholm left over Monica Apr 16 '14 at 16:19
-
I guess it is. But in book page, it is written like "1 and -1" – A.D Apr 16 '14 at 16:22
4 Answers
HINT:
Every positive integer can be written as $$6n,6n\pm1,6n\pm2=2(3n\pm1),6n+3=3(2n+1)$$

- 274,582
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$

- 43,109
-
-
-
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
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$.

- 272,048
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}$

- 2,954
- 5
- 21