Optimize erato sieve
We started crossing the numbers at 3*n, while we can start at n^2.db4
parent
e6a5ac4acd
commit
a843113326
|
@ -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 ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue