[Haskell-beginners] Re: Efficient sieve of erastothenes, for solving project euler problem #10?

apfelmus apfelmus at quantentunnel.de
Mon Nov 24 05:14:08 EST 2008


Malcolm Reynolds wrote:
> I'm attempting to learn Haskell by going through the project euler
> problems. Number 10,
> http://projecteuler.net/index.php?section=problems&id=10 , involves
> summing prime numbers. It's easy in terms of coding something up that
> works, but I'm having a lot of trouble getting decent performance.

See also

  http://haskell.org/haskellwiki/Prime_numbers


Note that your C version uses a different algorithm than your Haskell
version, the former uses an array with random access while the latter
uses a linked list.


Regards,
apfelmus



More information about the Beginners mailing list