[Haskell-beginners] Performance of Prime Generator
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.
nightmare = unsafePerformIO (getWrongWife >>= sex)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: not available
More information about the Beginners