From a843113326ec49f81f6fa7874e21c49a24899ba7 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Sun, 28 Dec 2008 11:43:13 +0100 Subject: [PATCH] Optimize erato sieve We started crossing the numbers at 3*n, while we can start at n^2. --- extra/math/primes/erato/erato.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/math/primes/erato/erato.factor b/extra/math/primes/erato/erato.factor index f4409038bb..effcd7b135 100644 --- a/extra/math/primes/erato/erato.factor +++ b/extra/math/primes/erato/erato.factor @@ -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 f swap ] keep [ set-nth ] curry with each ;