Sieve of Eratosthenes: Difference between revisions
Content deleted Content added
→Bounded sieve: upd link to the SWISH entry |
→Bounded sieve: name the subsection |
||
Line 13,796: | Line 13,796: | ||
</pre> |
</pre> |
||
====Sift the Two's and Sift the Three's==== |
|||
Another version, based on Cloksin&Mellish p.175, modified to stop early as well as to work with odds only and use addition in the removing predicate, instead of the <code>mod</code> testing as the original was doing: |
Another version, based on Cloksin&Mellish p.175, modified to stop early as well as to work with odds only and use addition in the removing predicate, instead of the <code>mod</code> testing as the original was doing: |
||
<lang Prolog>primes(N,[]):- N < 2, !. |
<lang Prolog>primes(N,[]):- N < 2, !. |