Yes, and that's pretty much what my version does (and what the
original tried to do?).
On Feb 11, 2007, at 20:14 , DavidA wrote:
If you want it fast, don't use a sieve method at all (or a wheel
method) - use
trial division:
primes = 2 : [p | p <- [3,5..], trialDivision primes p]
trialDivision (p:ps) n | r == 0 = False
| q < p = True
| otherwise = trialDivision ps n
where (q,r) = n `quotRem` p
trialDivision [] _ = True
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe