Slashdot Mirror


Fun with Prime Numbers

Steve Litt writes "Fun With Prime Numbers contains a series of prime number finding algorithms starting with the most brute force imaginable, and working up to a paged algorithm capable of finding the first 1,716,050,469 primes in an hour and a half on a commodity machine. There are faster algorithms on the net, but these algorithms are within the reach of mere mortals and are fully explained."

6 of 472 comments (clear)

  1. Have some more fun with primes by pestilence4hr · · Score: 4, Informative

    A very fast segmented sieve (to find primes in an arbitrary range) can be found here, by Tomás Oliveira e Silva.

    Of tangential interest is his Goldbach conjecture verification project. You can download his client and contribute to the project. He's shooting for 10^18...

  2. Re:This begs the question by YGingras · · Score: 5, Informative
    What's the 1,716,050,470th prime?
    The 1,716,050,470th prime is 40,100,000,093.

    Find out more on the Nth Prime Page.
  3. Re:A better use? by benna · · Score: 4, Informative

    encryption.

    --
    "It is not how things are in the world that is mystical, but that it exists." -Ludwig Wittgenstein
  4. Re:This begs the question: by Dasein · · Score: 4, Informative

    There are a lot of them.

    As a matter of fact 2048 bits can represent numbers up to 2^2048 ~= 3.23x10^616. By the Prime Number Theorem there is about 2.27x10^613 primes in that space. If each prime required 2048 bits to store, then storing all the 2048 bit primes requires more petabytes then you and I are likely to ever see.

    (Jeez I hope I didn't do the math wrong. The most convenient calc I have available to me as I write this in the Windows calc)

    --
    You are not a beautiful or unique snowflake -- but you could be if you got off your ass.
  5. Re:Mersenne by acidblood · · Score: 4, Informative

    I'd venture to say I know what I'm talking about. One can't publish a paper about large-scale distributed primality proofs without knowing these basics. Here's a sample of my work. Now don't get me wrong, I'm not trying to sound like a smart-ass, but I'm not going to let someone question my knowledge in this field (which I have studied for years) and remain quiet.

    Now it seems people here are not familiar with the terminology associated with Mersennes, so I'll give a crash course.

    A Mersenne number M_n is of the form 2^n - 1. If 2^n - 1 is prime, then M_n is a Mersenne prime. If 2^n - 1 is composite, then M_n is a Mersenne composite. The integer n in this expression is called the exponent. When I talk about `exponents of Mersenne composites', I'm refering to some prime n for which M_n = 2^n - 1 is composite.

    Now if 2^n - 1 is prime, then n must be prime, but the converse is not always true, the smallest counterexample being 2^11 - 1 = 2047 = 23*89. Turns out that for prime exponents n = 24,036,583, only in 41 cases is 2^n - 1 actually prime. A list of these cases can be found here. For the other 1,509,222 prime values of n = 24,036,583, 2^n - 1 is composite. This translates to a compositeness ratio of 99.9973%.

    I hope everything is clearer now.

    --

    Join the NFSNET. Our prime goal is making little numbers out of big ones. http://www.nfsnet.org/

  6. Re:This begs the question: by Omniscient+Ferret · · Score: 4, Informative

    On my computer, generating primes from 2 to 2^32 takes a third of the time to unbzip2 the same list.