# Why is $1007$ not prime, even though it can be represented as $6n\pm 1$?

It is said that every prime except $$2$$ or $$3$$ can be represented as $$(6n+1)$$ or $$(6n-1)$$. But when it comes to number $$1007$$, it can also be represented as $$(6 \cdot 168-1)$$ then

Why is $$1007$$ not prime?

• The logic of the statement is: $p>3~\text{is prime} \Rightarrow p = 6k\pm 1$ for some $k$; the statement doesn't work into the other direction. If it did, it would be super-easy to find new prime numbers. – Matti P. Jul 31 '19 at 5:18
• How do you know that 1007 is not prime? – Wlod AA Jul 31 '19 at 5:19
• The implication only goes one way: prime $p \neq 2, 3 \rightarrow p = 6n \pm 1$. But $p = 6n \pm 1 \not\rightarrow p$ prime. – 0XLR Jul 31 '19 at 5:20
• Every prime except $2$ is odd, but not every odd number is prime. – Blue Jul 31 '19 at 5:21
• It is said that every dog is a mammal. But when it comes to meerkats, they are also mammals. So why aren't meerkats dogs? – Gerry Myerson Jul 31 '19 at 6:22

Every prime except $$2$$ or $$3$$ is of the form $$6n\pm1$$, but not every number of the form $$6n\pm1$$ is prime
• E.g., $77=6\times13-1=7\times11$ – J. W. Tanner Jul 31 '19 at 5:18
• Or $25$; being of the form $6n\pm1$ ensures a number is not divisible by $2$ or $3,$ but it could have other factors – J. W. Tanner Jul 31 '19 at 5:20
Because $$1007=19 \cdot 53\ \ \ \ \ \$$
Not all numbers of the form $$6n \pm 1$$ are prime. Take for example, $$n = 4$$. $$6n + 1 = 6(4) + 1 = 25$$. Or, $$n = 6$$, which produces $$6n - 1 = 6(6) - 1 = 35.$$
A number of the form $$6n\pm1$$ can never have $$2$$ or $$3$$ as a factor, and $$\frac{2}{3}$$ of all numbers have one or both of those as a factor. That said, there is no further information in the form of the number per se which tells us about any other possible factors. It might be prime, or it might be composite and have prime factors. As other answers and comments have shown, there are plenty of numbers of the form $$6n\pm1$$ that have prime factors, and $$1007$$ is demonstrably one of them. In that case, $$1007$$ is not a prime number for the sole reason that it does not fit within the definition of a prime number. There is no further mathematical or mysterious reason why that is the case.