]> gitweb.factorcode.org Git - factor.git/commitdiff
Do not remove first primes only to prepend them afterwards
authorSamuel Tardieu <sam@rfc1149.net>
Fri, 26 Dec 2008 19:58:45 +0000 (20:58 +0100)
committerSamuel Tardieu <sam@rfc1149.net>
Fri, 26 Dec 2008 19:58:45 +0000 (20:58 +0100)
This makes little sense to use "lprimes-from" to get the
primes above one million to prepend the list of primes
before one million afterwards.

extra/math/primes/primes.factor

index 820d5b6c4a2f1d6619ca549bbffab585bdb8e867..2db81982d8a72cfe77c1f36c18072e3f86097bc7 100644 (file)
@@ -39,8 +39,7 @@ PRIVATE>
         { [ dup 1000003 < ] [
             primes-under-million [ natural-search drop 1+ 0 swap ] keep <slice>
         ] }
-        [ primes-under-million 1000003 lprimes-from
-            rot [ <= ] curry lwhile list>array append ]
+        [ lprimes swap [ <= ] curry lwhile list>array ]
     } cond ; foldable
 
 : primes-between ( low high -- seq )