Author | Message |
---|---|
rabbott
Posts: 1649
|
Posted 09:32 Feb 16, 2019 |
Here are the three versions of the Sieve of Eratosthenes discussed in the previous post. They have been re-written to be similar and easier to understand. sieve1 (p:ps) = p : sieve1 (filter (\n -> not (exclude n)) ps) primes1 = 2 : sieve1 [3, 5 ..] {--
primes2 = 2 : sieve2 [3, 5 ..] {--
primes3 = 2 : sieve3 [3, 5 ..] {--
Last edited by rabbott at
10:07 Feb 16, 2019.
|
rabbott
Posts: 1649
|
Posted 09:55 Feb 16, 2019 |
The preceding uses sieves discussed early in O'Neill's paper. I didn't read the entire thing, but at the end he discusses a "wheel" approach to eliminating numbers from the initial stream.
Last edited by rabbott at
10:09 Feb 16, 2019.
|