Print This Post Print This Post

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?

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…



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>

(required)

(required)


*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word