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

Twin Prime Sieve

  1. Oct 8, 2010 #1
    I am interested in twin primes and have not been able to find a simple "sieve" type function to calculate them.

    I created my own. You can find it at this URL:


    It calculates all the twins less than N.

    I also wrote a Mathematica version - its listed in the PDF - so you can play with it.

    Any links to other twin prime sieves would be helpful.

  2. jcsd
  3. Oct 9, 2010 #2


    User Avatar
    Science Advisor
    Homework Helper

    How efficient is your sieve? How long does it take to generate the twins up to 10^10, say? (There are 27412679.)

    Making a simple Eratosthenes-style sieve for twin primes is straightforward enough, but I wonder if anyone has tried to make a Bernstein-Atkin-style twin sieve. Is such a thing possible?
  4. Oct 10, 2010 #3
    Not very. I am more interested in this concept as opposed to actual use. My interest is in the abstraction of making the twin primes the sieve.

    It goes along with the boxed prime idea I posted a while back. I make triples of three odds what is sieved in this case. But you could do it for groups of six as well in which case the 19 and 109 values come out.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook