Sign In  Sign Up Live-Chat

Danny Cooper

Prime Numbers - There is a pattern!

Hey everyone,

I know this is a bit off topic; however, I thought it may be of interest to the programming community. A while back I discovered there is a pattern to prime numbers. I was very excited to find the pattern, but despite my best efforts I received little to no interest from the math community (this may very well have been because I was looking in the wrong place, but I really feel like I gave it a good effort). Therefore, in order to share the knowledge I thought that I would post it here in hopes that people could help spread the word.

Current mathematics states that there is not a prime pattern; that primes appear along the number line at random. I believe that conclusion was derived because people are looking at primes in a base 10 number system.



However, in a base 6 number system you will find that the primes form two straight lines (except for 2 and 3… they are special primes, similar to 1). So from a mathematics standpoint the following two equations make up those lines: (1 + 6x) and (-1 + 6x)



You will notice in the above screen shot that there are “skips” within the two lines (for example 25, 35, 49, 55, etc)… I was able to determine that the “skips” are factors of the primes… but not just any factors of the primes; it’s the factors of the primes times the other primes.

   

Therefore, if one is to calculate a prime – they have to know the number of “skips” that occur within the lines prior to the prime.  I then found that the space between the factors of the primes is a pattern as well. For example with factors of 5 the skips occur every 7th and then 3rd place (starting at 5)… the factors of 7 occur every 9th and 5th place (starting at 7) and so on…

In the end, the following is a true picture of the pattern (from a positive / negative side)...

I have created two different projects using the information I learned about the pattern. In the first project one can pass a number to a function and the function will then return the correct prime. It does so by determining the number of skips and then plugging the information into a math formula. However, it is quite slow when compared to a sieve (especially on very large numbers).

The second project is an improved version of the Sieve of Eratosthenes. It works in a much different fashion since the prime pattern is known. Based on my test so far it is between 100% and 150% faster than the basic sieve. If anyone would like copies of the projects, please feel free to email me for details.

If you know anyone that is interested in this sort of thing, please pass it along. I would love to get this information into the hands of the public.

 

Published Monday, August 28, 2006 11:57 PM by DannyCooper

Comments

 

jamfahr said:

interesting, though this appears to be well know. Do a search on google for "prime numbers base 6" and you'll find lots of information on this pattern.
August 29, 2006 3:23 AM
 

DannyCooper said:

I did the Google search; however, was unable to find anything that directly related to this.  In other words, I found several pages that use that contain all of the terms, but none that I saw contained similar information.  Could you share a URL to a site with a similar pattern?
August 29, 2006 7:16 AM
 

mgasystems said:

Interesting stuff... but here's an example of this being published (PDF):

http://www.dozenalsociety.org.uk/pdfs/primeforms.pdf
August 29, 2006 10:43 AM
 

DannyCooper said:

I read through the PDF and it has some very interesting information; however, I did not see it as a direct comparrison.  The document does outline base six and does identify (6x + 1) and (6x -1), but it does not address the skips in the pattern.  It actually refers to the base six pattern as being an imcomplete pattern.  The skips within the pattern are a very important part (simply being the factors of the primes times the primes).
August 29, 2006 11:01 AM
 

Scott Hanselman's Computer Zen said:

August 29, 2006 11:24 AM
 

Ken Egozi : IRresistible said:

August 29, 2006 11:55 AM
 

MZD said:

Umm...
A prime has no factors but one and itself.
You need to find and replace "factor" with "product".

I think you are on to something, but I still see skips that are not accounted for by your product theory...
August 29, 2006 12:30 PM
 

DannyCooper said:

Thank you for the comment and for the thoughts.  The skips that are not accounted for in the pictures are for the higher primes (11, 13, etc...)  In the pictures I had the factors of 5 and 7 marked...  However, you will note that the other skips still follow the same pattern.  I hope that helps...
August 29, 2006 12:36 PM
 

agoat said:

The reason base 6 has this pattern is a pretty simple removal of the products of those factors.  Columns 2, 3, 4, and 6 are all guaranteed to be products of 2, 3, 2, and 2 and 3 (respectively) because of the layout.  You can get a similar effect at the next level by going out to the prime (2 x 3 x .... 5 = 30 columns).  You'll get the same pattern with major vertical stripes, and less checkerboarding because you've removed your multiples of 5 (in light blue on yours).  However, you'll still get the effect from 7s, 11s, and so on (this starts to become unfeasible once you get past 2 x 3 x 5.  2 x 3 x 5 x 7 x 11 x 13 x 17 is a *** LOT *** of columns).

There are more interesting directions to go.  Try looking into Ulam's spiral.  You basically draw a spiral and space each number evenly along the path.  Then erase the non-primes.  The spiral starts to form distinct patterns.  If you do it on spirals with lines and corners, you'll see a lot of diagonal lines of primes.  If you use circular spirals you get some interesting arcs.

http://en.wikipedia.org/wiki/Ulam_spiral
http://static.flickr.com/28/49484569_a8614fcc5a_m.jpg
August 29, 2006 1:19 PM
 

Matevz Gacnik said:

Danny, if this stands for larger primes, or *all* primes, there is no way in the world you would not be known for eternity. How far did you push your algorithm?
August 29, 2006 1:23 PM
 

DannyCooper said:

I processed the first 100,000,000 numbers with the altered sieve with no variation in results from the Sieve of Eratosthenes.
August 29, 2006 1:40 PM
 

Chris said:

The patterns that you've discovered are basically what the sieve of eratosthenes does. The columns (except +-1 mod 6) are eliminated as eligible primes by virtue being products of 2 or 3. The blue diagonals are multiples of 5, the orange diagonals are multiples of 7, and if you were to continue, every "multiple of n" pattern would appear very regular in this chart.

I also don't understand the bit about the "primes times other primes"--every composite is of this form.

Oh, and the sieve of eratosthenes is not the best benchmark for prime testing. It's more or less the worst performant prime test that exists. :/
August 29, 2006 2:13 PM
 

Sam M. said:

Danny,

The numbers do seem to follow a specific pattern. What about making an application availble on the site to demonstrate your findings? You said you processed the first 100,000,000 numbers. I think that most of us would love to see this application running.

Sam M.
August 29, 2006 2:23 PM
 

DannyCooper said:

Hey Chris,

Thank you for the comments.  The pattern shown does make one think of what the Sieve of Eratosthenes does (by eliminating the factors of other numbers).  However, it is simply where the primes fall in a base 6 system.

To better elaborate on “the primes times other primes” comment, I am simply sharing that the skips found in the lines are always a product of a prime times another prime (and all of the products of primes times primes are found in those lines):

For example:

25 = 5 * 5
35 = 5 * 7
49 = 7 * 7
55 = 5 * 11
65 = 5 * 13
77 = 7 * 11
85 = 5 * 17
91 = 7 * 13
95 = 5 * 9
115 = 5 * 23
119 = 7 * 17
121 = 11 * 11

As for the sieve comment, I am not arguing that I have created the best sieve of all time.  I am simply sharing that there is indeed a prime pattern and the knowledge of the pattern can only help to improve our current means of doing things.
August 29, 2006 2:30 PM
 

DannyCooper said:

Hey Sam,

Thank you for the comments.  I had been sending out the links via email, but I think your right – it’d be a lot easier for everyone if I would post them here.  Below are the two project descriptions and links to both:

NewSieve.zip is a zip file that contains a console project comparing the new sieve to a basic sieve.  I named the new sieve “Agape Sieve” because I wanted to name the theory Agape Prime…

http://www.aspose.com/preview/danny/prime/newsieve.zip

Function.txt is a text file that contains the function for deriving a prime number (which is much slower than a sieve, but functional)

http://www.aspose.com/preview/danny/prime/function.txt

Both of the routines are written using VB.NET.  / VS.2003
August 29, 2006 2:39 PM
 

DannyCooper said:

As a note, in the Sieve Demo there is a variable named nRaceTo (which is currently set to 50,000).  Feel free to increase that value up to 100,000,000 (or higher if memory permits : )
August 29, 2006 2:47 PM
 

Chris said:

Danny,

If we disregard 2 and 3, then yes, all products of two primes fall into the columns you list. That's because all the primes are in those columns (+-1 mod 6) and the columns are closed under multiplication (+-1 * +-1 = +-1 in any modular arithmetic).

However, your claim that all the skips in these columns are the product of two primes is off. 125 = -1 mod 6, so is in the right column, but it is not prime, and is not the product of two primes (it's 5*5*5). _Any_ composite whose factors do not include 2 or 3 is in these two columns.
August 29, 2006 2:51 PM
 

DannyCooper said:

Hey Chris,

Thank you for the reply and for the further thoughts.  You are definitely correct about 125 not being the product of two primes.  I should have chosen my words more carefully and said that the skips are the products of the numbers within the lines (since not all are prime).  I think the truly important piece here is that there is a very clear pattern from which one could find other primes.  I hope that the knowledge of the pattern can be useful to those who work in this area of study.
August 29, 2006 4:22 PM
 

Sam M. said:

Danny,

Don't know if you have already done, but I dugg your page. I would like to see more people looking at your stuff.

Sam
August 29, 2006 7:29 PM
 

TBrown said:

Ready for something really strange...  I have worked on this before and my findings are that there almost seems to be a correlation between the DNA double helix and the Prime numbers algorithm.  If you look at the blue and yellow patterns shown in the images you will see a DNA like structure.
August 29, 2006 10:31 PM
 

Dan said:

Danny,

I think "base six number system" is an inappropriate term for this number arrangement.  When you say base six number system, the highest digit of your numbers should only be five.  Remember the binaries, octets and hexadecimals?

Anyway, this is interesting!
August 29, 2006 10:32 PM
 

Jon said:

This is interesting, but the work has basically been incorporated into other improved sieves (Atkin, etc).  They actually eliminate let you skip even more numbers than this for even faster speedup.
August 29, 2006 11:07 PM
 

RS said:

You're right about these things, for the reasons Chris stated. You can find this pattern already explained in the prime number article in www.mathworld.com
August 30, 2006 1:27 AM
 

YoMikbo said:

"Current mathematics states that there is not a prime pattern" is not quite true. There is a pattern, but it's not been found. But it has been alluded to. Bah. I'm going back to my zeta functions.
August 30, 2006 2:00 PM
 

Leslie Koller said:

And if you used just TWO columns at the top, 1 and 2, then EVERY SINGLE PRIME execpt two would appear in ONE AND ONLY ONE ROW!!!!  Big deal.
August 30, 2006 3:19 PM
 

romank said:

I'm no math wiz, sorry for ignorance in advance. Big prime numbers are used when kenerating encryption keys and that is computationally expensive from what I know. Does what you do allow calculating a big prime faster than existing algorithms?
August 30, 2006 3:26 PM
 

DannyCooper said:

Hey Roman,

Thank you for the question.  That is a really good question.  Knowing that such a pattern exist does not actually speed how primes are found.  It is what one does with the knowledge they gain from the pattern.  A similar example may be: Microsoft has developed a really awesome programming language called Visual Studio .NET 2005.  A person then asks "Will it allow me to create better programs faster?" … it really depends on how they use it.

That being said, I have personally found things in the pattern to speed prime searches.  For example, I found that one does not have to worry about the every multiple of numbers in the lines… just every 4th and 6th.

Below I have pasted some more pictures to better explain:
http://www.aspose.com/images/prime/screen7.gif
http://www.aspose.com/images/prime/screen8.gif
http://www.aspose.com/images/prime/screen9.gif
http://www.aspose.com/images/prime/screen10.gif

In the above pictures you will see the multiples of 5, 7, 11 and 13 …  However, you will notice that with each one there is 3 skips in the middle and 1 skips on the side.  Therefore, when flagging numbers in a sieve - one would not need to worry about the ones in the middle or on the side… only the ones that occur on the lines.

For the number five you would do the following:

5 = prime
5 + (5 * 4) = 25
25 + (5 * 2) = 35
35 + (5 * 4) = 55
55 + (5 * 2) = 65

For the number 7 you would do the following

7 = prime
7 + (7 * 4) = 35
35 + (7 * 2) = 49
49 + (7 * 4) = 77
77 + (7 * 2) = 91

Etc…  Therefore, there is a speed increase because one only needs to mark certain items.

The key here is knowing there is a pattern and then learning more about the pattern to create faster algorithms.  I hope that helps.

August 30, 2006 9:20 PM
 

TBrown said:

We already know how to exlude numbers from the prime list.  All you are doing is finding the factors of numbers you want to exclude.

The real pattern you should be stating above is that every number excluded is a product of one of the odd values starting at 3.  So 3 would be mulitplied by all other odd numbers to produce an exluded number.  Then you start with 5 and multiply it by all other odd numbers.

exclude list:
3*3 = 9
3*5 = 15
3*7 = 21
5*5 = 25
5*7 = 35
...
(to elude to the 125 special number above it is not 5*5*5)
5*25 = 125  (I know it is the same but doing 5*5*5 does not follow the pattern of exclusion)


Being exclusionary is nothing new.  You need to find an inclusionary pattern to really solve the problem.
August 31, 2006 7:11 AM
 

DannyCooper said:

Hey TBrown,

Thank you for the reply and for the thoughts.  The altered version of the sieve I created (using the above understanding of the pattern) works differently than the standard sieve… A standard sieve does the following

   1)      Everything is marked as “unknown”
   2)      1 is treated special
   3)      2 is marked as prime and all of the factors of 2 are then removed
   4)      3 is marked as prime and all of the factors of 3 are then removed
   5)      The routine then looks for the next “unknown” array item and considers it prime
       a.       It then flags all of the factors for that prime and goes to the next

In the above model, primes are found based on the next “unknown” value…  The sieve I created works differently.

   1)      It initially marks everything composite
   2)      2 and 3 are marked prime (because they a standalone primes)
   3)      It then flags the primes based on the (1 + 6x) and (-1 + 6x) pattern
   4)      It then starts at 5 and only flags the 4th and 2nd (as shown above) multiples of the numbers in the line
       a.       Based on the pattern shown in the images…
   5)      There is no need to continue once you make it past half way in the sieve
       a.       That is because after half way, there would be no remaining factors

Based on the reduced amount of processing, the above model works quicker.  However, all of that was derived from closely examining the pattern.

I really like the way you phrased exclusionary vs. inclusionary … That makes complete and perfect sense.  Unfortunately, one can look at the exclusionary pattern and know for certain there is not an inclusionary one.

August 31, 2006 11:24 AM
 

AdamReynolds said:

About the DNA remark - the blue and orange crosses would have to have equal spacing for it to resemble DNA. In reality, simple latticework in your garden more resembles DNA than this pattern.

Nonetheless, it is amazing how much math is reflected in natural structures.
August 31, 2006 12:43 PM
 

stderr said:

Hmm, didn't I leave a comment here earlier?

Wonder where it is...
September 1, 2006 1:08 PM
 

DannyCooper said:

If your orgiginal comment provided any useful knowledge I would have left it.  Please note there are plenty of criticisms in the above comments ... however, unlike yours they are not insulting.  If you'd like to discuss something, please feel free.  If you're bored and are looking for confrontation, please look elsewhere.
September 1, 2006 1:13 PM
 

stderr said:

Ok, let me rephrase it then...

You haven't found a prime-pattern. You have found a non-prime-pattern. The non-prime-pattern is that all the non-primes are products of two numbers.

This is nothing new...
September 1, 2006 1:22 PM
 

Todd said:

"I am simply sharing that the skips found in the lines are always a product of a prime times another prime"

Yes, that is the Fundamental Theorem of Arithmetic which Euclid proved sometime before Jesus was born. :-P

I don't mean to sound haughty. In fact, I had to go look up the name of that theorum, and who first proved it, and when he lived. I just happened to already know of the concept. :)
September 1, 2006 3:03 PM
 

Silchan said:

This page talks about the 6a+ or -1 pattern and the 5 pattern

http://www.abarim-publications.com/ulamgohome.html

It is a well known theorem.
September 3, 2006 12:10 AM
 

Cory said:

But really, the people who found that theorem were considered brilliant and well ahead of their time. So to find this pattern on your own, whether it is well-known or not, is still very very cool and I applaud your original way of thinking.
September 4, 2006 9:11 PM
 

Senses said:

You have an insanely supportive community here. Most other places on the net would have (correctly) ripped apart your ideas and said you were not the first to create it but (incorrectly) insulted your intelligence and possibly your mother.
September 4, 2006 11:39 PM
 

Steendor said:

Regarding generating primes for encryption:

Most commonly, "prime" numbers are generated randomly, and then tested for primality.  These tests do not allow for 100% confidence:
http://en.wikipedia.org/wiki/Primality_test#Probabilistic_tests

This is done for two reasons: #1 - Generating primes randomly helps prevent someone correctly guessing the key because they know the method used to generate primes.  #2 - The prime numbers involved are so _huge_ that using a sieve method to ensure primality is prohibitive - sieves require far too much memory.  A 128-bit prime can range up to around 3.4e+38 - at best, I suspect a sieve method would still require more than 10e+30 bytes of RAM.  Nowadays, many implementations work with far larger primes than that.
September 5, 2006 8:40 AM
 

Eric said:

Isn't the problem with this the fact that we aren't actually counting in base 6, but rather just adjusting the loop. It's like cutting a deck of cards, you change the organization but not the order.
September 14, 2006 7:51 PM
 

Carey said:

Just because you figured out something that’s very similar to another theory, do not let this dampen your enthusiasm. And don’t listen to the comments by people that only offer destructive criticism. All great theorists throughout history have thought outside the norm. And if they listened to the negative things that people said to them, and then no advancement in mathematics would ever be achieved (especially physics)

Just remember this! If you figured the above pattern by yourself, then you are already one step in front of most people. Why? Its simple, most people need it to be shown to them for them to understand (they can’t figure it out for themselves). You will always have a greater depth of understanding due to this.

Mathematics is continuously being rediscovered by people.

Anyway good luck with all future mathematics


Carey  

(btw I am a physicist)
September 14, 2006 8:26 PM
 

TMind said:

I have had similar thoughts about this,
but have a look at some books I have read,
really interesting stuff.
Unfortunately I don't know if there is an
english translation available but the books
are called : "Das Primzahlkreuz"
or in english maybe "Cross of Primes" I dunno,
and it is from a Professor called Peter Plichta.

Here is a link:
http://www.plichta.de/deutsch/d_b_primzahlkreuz3.php
September 14, 2006 10:48 PM
 

TDG said:

That isn't a base 6 numbering system. A base 6 numbering system looks like this:

00, 01, 02, 03, 04, 05,
10, 11, 12, 13, 14, 15,
20, 21, 22, 23, 24, 25

What you've done is arrange the base-10 numbers into columns of 6.

Naturally, the 6n +/-1 rule holds. Numbers that are 6n are multiples of six, numbers that are 6n + 2 are multiples of 2, numbers that are 6n + 3 are multiples of 3, and numbers that are 6n + 4 are multiples of 2.

The pattern of gaps is interesting, particularly the diagonals (although they appear to miss 143, 169, and 187 at least). However, your pattern probably won't hold out for much longer. The primes are said to be randomly distributed because computers have arranged the numbers up to a few hundred billion into columns like this, and didn't come up with any patterns.

Also, the fundamental theorem of arithmetic - the one on which all other arithmetic is founded - says that all numbers are a unique product of primes. What you've noticed is the same as the fundamental theorem, which is a feat in itself if you have no mathematical training. You should look into a degree in mathematics, where you can make proper advances after learning what people already know.

However, you've found nothing new here.
September 21, 2006 6:54 AM
 

Erskina said:

i really have no understanding of this though i am trying .. i have no understanding of numbers but hoesntly i think its cool you are trying to think of something like this
September 22, 2006 3:04 PM
 

kosmas said:

Halo.

  I want to say that I am glad that I found this site because ... I have also found myself this pattern and the relations with the non-primes in the list!!! I am glad because I was wondering if someone else had found that out and I was almost sure that someone did it. It is so obvious and the area of prime numbers is one of the most studied. I am not a mathematician, I am a composer and I found that because also in music the numbers and especially the prime numbers have unique abilities. First of all in music we are thinking in system mod12 because the notes are 12. So in every 12 notes we have the octave. And the numbers 5,7,11,13 have the ability to create unique harmonies. If you name the notes C=1,C#=2,D=3,D#=4... and you take the fifth, tenth , fifteenth .... you will have the famous quartal harmony witch has the ability to have all the 12 tones in order to complete a cycle. With 7 we have the quintal harmony and with the 11 and 13 others harmony with the same characteristic. So using these harmonies in my pieces and with my small interest about prime numbers I found the pattern 6x+1, 6x-1.
   Now I want to challenge the mathematicians to prove that all prime numbers except 1,2,3 belong to this pattern. And all numbers in this pattern cannot divided by 2 or 3. Or the opposite. And also I think it could be a good idea to make some diagrams with the success's percentage of all prime patterns in finding primes for various values of x.    
  I want to apologize because I am not a mathematician and no native-English speaker if I said something wrong. Keep up the searching spirit!

Friendly regards,
Kosmas
October 15, 2008 6:27 PM
Anonymous comments are disabled