Sieve of Eratosthenes: Difference between revisions

→‎Tree-merging incremental sieve: increase the sub-section level
(→‎With Wheel: A. comment is not code. B. Rosetta Code is for simple and illuminating codes first. we _add_ the better performant (and very long) ones, not replace.)
(→‎Tree-merging incremental sieve: increase the sub-section level)
Line 5,590:
The above code is also useful to a range of the first million primes or so. The code can be further optimized by fusing <code>minus [3..]</code> into one function, preventing a space leak with the newer GHC versions, getting the function <code>gaps</code> defined below.
 
====Tree-merging incremental sieve====
Linear merging structure can further be replaced with an wiki.haskell.org/Prime_numbers#Tree_merging indefinitely deepening to the right tree-like structure, <code>(a-(b+((c+d)+( ((e+f)+(g+h)) + ... ))))</code>.
 
751

edits