[Haskell-cafe] how to make haskell faster than python at finding primes?

Vimal j.vimal at gmail.com
Mon Aug 6 05:37:59 EDT 2007


> primes n = sieve (take n [2..])
> sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p > 0]
> print (primes 1000)
>
> -- Vimal

But as we can see, this obviously doesn't *take* 1000 primes,
:-)

-- Vimal


More information about the Haskell-Cafe mailing list