The act of searching for a pattern to the prime numbers can be both exciting and frustrating. Exciting when you think you might be on to a pattern, frustrating when the pattern is broken. Reason seems to tell us that there has to be a pattern. There is a clear and obvious pattern to the multiples of 2, the multiples of 3, the multiples of 5, etc. In other words, there are patterns to the non-prime numbers. And yet, there doesn't seem to be, for when we overlay the patterns of the non-prime numbers, a sort of chaos emerges.
If there is a pattern to prime numbers, then there is a formula that produces nothing but primes.
When I first considered the equation 6n +/- 1 = p, I was excited, thinking I was on the scent of a pattern, and wondered if no one had thought of it before.
For n = 1, the formula gives 5 and 7, both prime.
For n = 2, the formula gives 11 and 13. So far, so good.
For n = 3, the formula gives 17 and 19.
For n = 4, the formula gives 23 and 25. Already, our hopes are dashed. But wait a minute: notice that 25 is 5 squared, and 5 is a prime. What if we alter our formula to read 6n +/- 1 = p OR p2?
For n = 5, the formula gives 29 and 31. We're chugging right along.
For n = 6, the formula gives 35 and 37. Again, we run into trouble. 35 is neither prime, nor the square of a prime. I'm not ready to give up yet. 35 = 5 * 7, that is, the product of consecutive primes. So we amend the formula to read 6n +/- 1 = p OR p2 OR pxpx + 1.
For n = 7, the formula gives 41 and 43.
For n = 8, the formula gives 47 and 49. 47 is prime, while 49 is 72.
For n = 9, the formula gives 53 and 55. 53 is prime, but 55 is neither prime, nor the square of a prime, nor the product of consecutive primes. However, it is the product of two primes, namely, 5 and 11. So we amend the formula to read 6n +/- 1 = p OR p2 OR pxpy.
For n = 10, the formula gives 59 and 61.
For n = 11, the formula gives 65 and 67. 67 is prime, while 65 = 5 * 13. You might have noticed that when the formula's result is neither a prime nor the square of a prime, it is the product of 5 and another prime. But since we've changed the formula too many times already, I would prefer to avoid changing it unless it's absolutely necessary.
For n = 12, the formula gives 71 and 73.
For n = 13, the formula gives 77 and 79. 79 is prime, but 77 = 7 * 11. Aren't you glad we didn't change the formula?
For n = 14, the formula gives 83 and 85. 83 is prime, 85 = 5 * 17.
For n = 15, the formula gives 89 and 91. 89 is prime, 91 = 7 * 13.
For n = 16, the formula gives 95 and 97. 97 is prime, 95 = 5 * 19.
For n = 17, the formula gives 101 and 103.
For n = 18, the formula gives 107 and 109.
For n = 19, the formula gives 113 and 115. 113 is prime, 115 = 5 * 23.
For n = 20, the formula gives 119 and 121 For the first time, the formula fails to yield any primes. At least 119 = 7 * 17 and 121 is 112.
For n = 21, the formula gives 125 and 127. 127 is prime, but with 125 we have run into a problem. 125 is neither prime, nor the square of a prime, nor the product of two primes. It's 5 cubed. I'm losing patience, but I'm not ready to give up on the formula yet. So we amend it to read 6n +/- 1 = p OR px OR pxpx + 1.
For n = 22, the formula gives 131 and 133. 131 is prime, 133 = 7 * 19.
For n = 23, the formula gives 137 and 139.
For n = 24, the formula gives 143 and 145. 143 = 11 * 13, 145 = 5 * 29.
For n = 25, the formula gives 149 and 151.
Suffice it to say, that this formula works as expected until n = 64, when it gives 383 and 385. 383 is prime, but 385 is neither prime, nor the power of a prime, nor the product of two primes. It's the product of three primes, namely, 5, 7 and 11. And if we go to n = 834, we get 5003 and 5005, of which 5003 is prime and 5005 = 5 * 7 * 11 * 13. If we go high enough, we'll find cases of our formula giving numbers that are the products of five, six, seven, eight factors and so on and so forth. To say that our formula gives either a prime, the power of a prime, or the product of primes, is almost pointless, as that practically covers all integers.
However, we can prove that this formula gives ALL primes higher than 3, despite giving plenty of non-prime results besides, and that is an achievement after all.
Unfortunately, I didn't discover it. I did some research in the library, and found this formula had been discovered centuries ago.
Let's try something else.