A simple sieve in Phobos?

Chris Williams yoreanon-chrisw at yahoo.co.jp
Tue Mar 18 17:56:31 PDT 2014


On Tuesday, 18 March 2014 at 14:23:32 UTC, bearophile wrote:
> Is it a good idea to add a simple but reasonably fast Sieve 
> implementation to Phobos? I have needed a prime numbers lazy 
> range, and a isPrime() function numerous times. (And as for 
> std.numeric.fft, people that need even more performance will 
> use code outside Phobos).

My new job has finally given me permission to continue some work 
I was doing for Phobos, which includes an implementation of RSA. 
RSA uses primes quite heavily, so an isPrime() method is part of 
that. I think I templated it to accept BigInt or regular ints, 
but even if not, that should be an easy addition.

I could break out that and a few other basic math 
functions/algorithms into its own small pull request, if desired?


More information about the Digitalmars-d mailing list