Skip to content

Commit 34b44a8

Browse files
dieggsypavpanchekha
authored andcommitted
Add more explicit references to primality tests
1 parent dcd2ea1 commit 34b44a8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

math-lib/math/private/number-theory/number-theory.rkt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
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
@@ -192,6 +193,8 @@
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))

math-lib/math/private/number-theory/small-primes.rkt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
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

0 commit comments

Comments
 (0)