math.primes.erato.fast: use literals to show how the wheel is calculated.

db4
John Benediktsson 2015-06-16 18:44:08 -07:00
parent 3678f62508
commit 8b6c743e02
1 changed files with 8 additions and 6 deletions

View File

@ -1,17 +1,19 @@
! Copyright (C) 2015 John Benediktsson ! Copyright (C) 2015 John Benediktsson
! See http://factorcode.org/license.txt for BSD license ! See http://factorcode.org/license.txt for BSD license
USING: bit-arrays fry kernel kernel.private locals math USING: bit-arrays fry kernel kernel.private literals locals math
math.functions math.private sequences sequences.private ; math.functions math.private math.ranges math.statistics
sequences sequences.private ;
IN: math.primes.erato.fast IN: math.primes.erato.fast
<PRIVATE <PRIVATE
CONSTANT: wheel-2-3-5-7 B{ CONSTANT: wheel-2-3-5-7 $[
2 4 2 4 6 2 6 4 2 4 6 6 2 6 4 2 6 4 6 8 4 2 4 2 4 8 6 4 6 2 11 dup 210 + [a,b] [
4 6 2 6 6 4 2 4 6 2 6 4 2 4 2 10 2 10 { 2 3 5 7 } [ divisor? ] with any? not
} ] B{ } filter-as differences
]
:: each-prime ( upto sieve quot -- ) :: each-prime ( upto sieve quot -- )
11 upto integer>fixnum-strict '[ dup _ <= ] [ 11 upto integer>fixnum-strict '[ dup _ <= ] [