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
parent
66b410b81f
commit
7303316a04
|
@ -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 )
|
||||
|
|
Loading…
Reference in New Issue