Do not remove first primes only to prepend them afterwards

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.
db4
Samuel Tardieu 2008-12-26 20:58:45 +01:00
parent 66b410b81f
commit 7303316a04
1 changed files with 1 additions and 2 deletions

View 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 )