[Haskell-beginners] Performance of Prime Generator

Ertugrul Söylemez es at ertes.de
Sat Jan 21 15:38:31 CET 2012


Zhi-Qiang Lei <zhiqiang.lei at gmail.com> wrote:

> Hi, what do you mean "more naive wheel trial division"?

Just use a wheel like 2*3*5 and don't bother only dividing by primes.
Trying to divide only by primes takes more time than just living with
the few percent nonprimes that slip through the wheel.

Or better yet, use a sieve like the Sieve of Eratosthenes or the Sieve
of Atkin.  Those are fairly easy to implement in Haskell.


Greets,
Ertugrul

-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120121/c247404c/attachment.pgp>


More information about the Beginners mailing list