Optimize erato sieve

We started crossing the numbers at 3*n, while we can start at n^2.
db4
Samuel Tardieu 2008-12-28 11:43:13 +01:00
parent e6a5ac4acd
commit a843113326
1 changed files with 1 additions and 1 deletions

View File

@ -8,7 +8,7 @@ IN: math.primes.erato
2 * 3 + ; inline
: mark-multiples ( i arr -- )
[ dup index> [ + ] keep ] dip
[ index> [ sq >index ] keep ] dip
[ length 1 - swap <range> f swap ] keep
[ set-nth ] curry with each ;