LibGMP Version of Rowland’s Prime Generating Function
I took Christian Sonne’s C-language version of Eric Rowland’s algorithm to generate prime numbers, optimized it and enhanced it to use the GNU MP multiple precision arithmetic library.
This means you can keep on running it as long as you like and occasionally peek which primes pop out. It might be good to redirect the output to a file, too.
Grab the source here.


2 Comments so far
Leave a comment
Could you somehow parallelize this to take advantage of multiple cores?
By Jaska on 07.23.08 11:05
The bottleneck is the GCD algorithm. If that could be parallelized, or sped up for this special case, then multiple cores would indeed offer speedups…
By slinky on 07.23.08 18:52
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>