]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/math/primes/primes.factor
factor: trim using lists
[factor.git] / basis / math / primes / primes.factor
index 642f8ef8e4b5a74d48f3aca153a15c4eb59b78e5..dce69fe67fa42a62ae435d786aab12e40228d8da 100644 (file)
@@ -1,18 +1,18 @@
 ! Copyright (C) 2007-2009 Samuel Tardieu.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: combinators combinators.short-circuit fry kernel locals
+USING: combinators combinators.short-circuit kernel
 math math.bitwise math.functions math.order math.primes.erato
-math.primes.erato.private math.primes.miller-rabin math.ranges
+math.primes.erato.private math.primes.miller-rabin ranges
 literals random sequences sets vectors ;
 IN: math.primes
 
 <PRIVATE
 
 : look-in-bitmap ( n -- ? )
-    integer>fixnum $[ 8999999 sieve ] marked-unsafe? ; inline
+    integer>fixnum $[ 8,999,999 sieve ] marked-unsafe? ; inline
 
 : (prime?) ( n -- ? )
-    dup 8999999 <= [ look-in-bitmap ] [ miller-rabin ] if ;
+    dup 8,999,999 <= [ look-in-bitmap ] [ miller-rabin ] if ;
 
 : simple? ( n -- ? )
     { [ even? ] [ 3 divisor? ] [ 5 divisor? ] } 1|| ;
@@ -76,7 +76,7 @@ PRIVATE>
 : nprimes ( n -- seq )
     2 swap [ [ next-prime ] keep ] replicate nip ;
 
-: coprime? ( a b -- ? ) fast-gcd 1 = ; foldable
+: coprime? ( a b -- ? ) simple-gcd 1 = ; foldable
 
 : random-prime ( numbits -- p )
     [ ] [ 2^ ] [ random-bits* next-prime ] tri