Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Found Some Pattern in prime numbers

  1. Oct 23, 2011 #1
    Hi guys,

    I always wanted to know if one could generate prime numbers according to an equation,so I wanted to go and study prime numbers little bit and know how exactly its gets formed and its logic.
    So as we all know that prime number is any natural number that is divisable by itself and 1 only,but since all prime numbers are odd(except two then it can be of the following form)

    2n - 1 or 2n + 1 for example

    3 = 2 * 1 + 1 OR 3 = 2 * 2 - 1;

    So I decided to take the form 2n + 1 and see how multiples of two change and see if I could find any pattern in the multipales of two in which there could be a equation that would generate it,so I did exactly that.

    I made the pattern that I find is according the difference between the multiples like how much N increases on each member:

    For example:

    3 = 2 * 1 + 1;
    5 = 2 * 2 + 1;

    Here the n increased by 1,so when I made for first 29 member I find this some difference gets repeated for N(that is the difference between multipales of two) like Difference 1,3,2 gets repeated every some members,so does this mean that there exists a function of some form: 2n + 1 ..... that would generate prime numbers according to the element you want?

    I made also a C program in order to check if this pattern increases as we go generate larger prime numbers I found that it does increase,so its not just the first 29 members or is this pattern of difference between multiples of two just random ?
  2. jcsd
  3. Oct 23, 2011 #2
    numerical evidence is no proof in number theory, especially if it does not extend very far like in your case. here's a good link for all things prime.
  4. Oct 25, 2011 #3
    Thanks alot for the link mate I will check it out.
  5. Oct 25, 2011 #4

    I was checking today with my program I made the pattern that I found I have found that is is increasing as we the number of prime we generate (I used sieve method to generate it in my program). Wouldn't that be logical that those difference in the multiplication of 2s pattern would have the same function in order to generate Prime numbers ?

    Doesn't this indicates that some primes follow same specific function in order to generate them?
  6. Oct 25, 2011 #5


    User Avatar
    Gold Member

    Just out of curiosity, why do you consider 2n - 1 and 2n + 1 to be different cases? I don't get the difference since one is just the other with an n that differs by 1. That is, anything that can be expressed as 2n-1 can equally well be expressed as 2n+1, just with an n that is one lower.
  7. Oct 26, 2011 #6
    It would have same pattern,but just the multiples would have differ by one I just wanted to stay consistent so I have 1 equation in my program.

    Its just out of being consistent not logic,so I don't keep switching between equation on every prime number.
  8. Oct 26, 2011 #7


    User Avatar
    Gold Member

    Sorry, but I don't understand a word of that. Well, I mean I DO understand the words, but when you put them together in that order, I have no idea what the sentence means. Could you expound on that?
  9. Oct 27, 2011 #8
    Since they are the same,but only 1 increment in the multipales of two,so I just choosed one of them when I started looking at this pattern and use it so when I analyze the multiples of two between prime numbers I see the same equation not different on each number thats what I meant when I said consistent. Also because I used code after that to analyze the prime number and the pattern its more efficient to use 1 equation.
  10. Oct 27, 2011 #9
    GeneR, maybe you can provide some data ( a table in pdf form would do ) so that people can see for themselves what patterns you have uncovered. For my part, I am not very knowledgeable in number theory so I can't answer any of your questions. I would say though that such a simple pattern would have been discovered a long time ago by one of the 1000's of people who spent countless hours working on "primes patterns".
  11. Oct 27, 2011 #10
    Are you just using prime numbers for the multiplier of 2 and than adding a 1??

    I ask this since 2 times 4 plus one is 9 which is not a prime, yet, of course 2 times 5 plus one is 11 which is a prime.

    Or in other words is it 2 * Prime number +1??
  12. Oct 28, 2011 #11
    I think he's investigating the n for which 2n+1 (or 2n-1, this is unclear to me) is prime. It's not very clear, but he seems to suggest that he's found a pattern in the behaviour of n. From what I'm able to decode, he hasn't presented any results yet.
  13. Oct 28, 2011 #12

    Every prime other than 2 is odd,so it can be of this form
    Prime(x) = 2n + 1;
    or you can generate it using Prime(x) = 2n - 1;

    So if one can figure out the difference of N between each member of the prime number and see how the multipales of 2 changes from each member,then its possible to get a function to generate those primes seems logical right? Thats exactly what I did.

    For example:
    3 = 2 * 1 + 1;
    5 = 2 * 2 + 1;

    So we can see that difference is 1 here in the multipale so I decided to analyze the pattern according to difference between multipales and see if I could find any pattern as I go analze more numbers,since I reasoned if there is pattern then members that have same difference could have the same equation to generate them,since they exhibit the same rate.

    I that the difference between multipales that generate first primes also repeat as we go along,but some more than others.
    For example 1,3,2 difference occurs alot first 10k primes this is a list I made according to what I have found until the 28th prime,but I made a program in order to check more prime and made it check the first 100 thousand.

    So if you see in the text you will find 1,3,2 difference occurs 3 times,also other difference occurs too as we go generate more prime numbers.

    I have made also made a program and used sieve method to generate prime to check this pattern and I have found that the number of found difference according to text is increasing as we increase the number of primes I generated.

    Attached Files:

  14. Oct 28, 2011 #13

    Yes your right I am analyzing how n changes the ("the multipales of two changes") on every member of the prime numbers,also 2n-1 is the same as 2n + 1 its just has one more incrementing of the two.

    For example
    3 = 2 * 1 + 1;
    3 = 2 * 2 - 1;

    Its the same,but the multipale of two will be always be +1 for the same members of the other one.
    5 = 2 * 2 + 1;
    5 = 2 * 3 - 1;

    But I choosed 2n - 1 to work with to be consistent as I said above.
  15. Oct 28, 2011 #14
    The question is not to find a function that generates few primes, the real question is can we find a function that can generate all the primes. And that is where the difficulty lies. ( I am aware that there are pseudo functions out there but no mathematician has ever taken them seriously ).
  16. Oct 29, 2011 #15


    User Avatar
    Science Advisor
    Gold Member

    There is no generic algorithm for generating prime numbers. That is why they are used for encryption.
  17. Oct 29, 2011 #16
    Yes there is no generic function that would generate it in efficient time,but I think there exists a function because if one sees the multiple of twos between prime we would find that that multipale is either a prime number or a multipale that is between two prime numbers.

    Also If I had to guess I think that function would have to modify N(the multipales of two) according to the prime generated thats according to those pattern I saw.
  18. Oct 29, 2011 #17
    I can see what you are saying, yet the problem is those odd numbers that are not prime, and how do they relate to your pattern??

    Such as 9 is 2*4 +1

    Simply put how will your pattern distinguish between non prime and prime??

    I am all for playing with numbers as one learns from such. don't take what I and others say as a downer.

    As you say all primes greater than 2 are odd: Yet all odd numbers are not prime. So how does your pattern differentiate between prime and non prime??
  19. Oct 29, 2011 #18

    Well I said all prime numbers are odd,but I didn't say all odd are prime numbers 9 can be broken down further into 3 * 3,but other odd prime number can't be broken down further.

    In my pattern I am simply seeing how the multipale of 2(N) changes between two consecutive,because if we can figure out how the multiple of two changes(In my case N) then its possible to make a function that would generate prime numbers according to the element we need.
  20. Oct 29, 2011 #19
    I think the patterns you noticed only repeat at best at random intevals, and that there will always be exceptions to your pattern no matter how detailed you make it, which is why a few people have asked you how can your patterns distinguish between prime and non prime numbers. As a matter of fact, every integer greater than 1 is either prime or a multiple that is between two primes. As you get into the large integer range, you will find gaps between primes that are as large as you can possibly imagine (except for the fact that there is always at least one prime between n and 2n for n>1) because assuming an odd integer n, after n! + 1, the next n numbers will all be multiples of primes.
    Last edited: Oct 29, 2011
  21. Oct 29, 2011 #20

    Yes,I think your correct because I thought about that too thats why I asked this quesiton.
    I think its just a pattern at random intervals only,but its what made me wonder more is that the pattern number was increasing as I generated more numbers in my program.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook