! Copyright (c) 2007 Samuel Tardieu.
! See http://factorcode.org/license.txt for BSD license.
-USING: bit-arrays kernel lazy-lists math math.functions math.ranges sequences ;
+USING: bit-arrays kernel lazy-lists math math.functions math.primes.list
+ math.ranges sequences ;
IN: math.erato
<PRIVATE
PRIVATE>
: lerato ( n -- lazy-list )
- <erato> 2 [ drop next-prime ] curry* lfrom-by [ ] lwhile ;
+ dup 1000003 < [
+ 0 primes-under-million seq>list swap [ <= ] curry lwhile
+ ] [
+ <erato> 2 [ drop next-prime ] curry* lfrom-by [ ] lwhile
+ ] if ;