File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
math-lib/math/private/number-theory Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 131131
132132;;; PRIMALITY TESTS
133133
134+ ; From Modern Computer Algebra by Joachim von sur Gathen and Jürgen Gerhard
134135; Strong pseudoprimality test
135136; The strong test returns one of:
136137; 'probably-prime if n is a prime
192193(: prime? : Integer -> Boolean)
193194(define prime?
194195 (let ()
196+ ; Sieve of Eratosthenes
197+ ; https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
195198 ; TODO: Only store odd integers in this table
196199 (define N *VERY-SMALL-PRIME-LIMIT*)
197200 (define ps (make-vector (+ N 1 ) #t ))
Original file line number Diff line number Diff line change 66 [bit-vector-set! (BitVector Integer Boolean -> Void)]
77 [bit-vector-ref (BitVector Integer -> Boolean)])
88
9+ ; Primality testing using a Sieve of Atkin
10+ ; https://en.wikipedia.org/wiki/Sieve_of_Atkin
11+
912(provide small-prime?
1013 *SMALL-PRIME-LIMIT*)
1114
You can’t perform that action at this time.
0 commit comments