Skip to content

Commit e96d707

Browse files
fepaul-bookfepaul
andauthored
changed documentation of isprime(n::Integer) -> Bool (#147)
* changed documentation of isprime(n::Integer) -> Bool - shows exactly when probabilistic methods are applied and when not - mentions the used methods changed documentation of isprime(x::BigInt, [reps = 25]) -> Bool - stated where the function is_probably_prime comes from and explains what it does --------- Co-authored-by: fepaul <[email protected]>
1 parent fef5fcd commit e96d707

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Primes.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,14 @@ end
156156
"""
157157
isprime(n::Integer) -> Bool
158158
159-
Returns `true` if `n` is prime, and `false` otherwise.
160-
159+
Returns for values in the range of an INT64 variable: `true` if `n` is prime, and `false` otherwise
160+
for bigger values: `true` if `n` is probably prime, and `false` otherwise (false-positive rate = 0.25^reps with reps=25 --> considerered safe)
161+
162+
More detailed:
163+
for even numbers: returns deterministic and correct results
164+
for values in the range of an INT64 variable: returns deterministic and correct results (by Lookup-tables, trial-division, Miller-Rabin, Lucas-Test)
165+
for bigger values: returns probabilistic resultsfrom GNU Multiple Precision Arithmetic Library
166+
161167
```julia
162168
julia> isprime(3)
163169
true
@@ -290,6 +296,9 @@ end
290296
Probabilistic primality test. Returns `true` if `x` is prime with high probability (pseudoprime);
291297
and `false` if `x` is composite (not prime). The false positive rate is about `0.25^reps`.
292298
`reps = 25` is considered safe for cryptographic applications (Knuth, Seminumerical Algorithms).
299+
300+
is_probably_prime is inherited from the module IntegerMathUtils that provides a wrapper to access
301+
functionality from the GNU Multiple Precision Arithmetic Library (GMP) library
293302
```julia
294303
julia> isprime(big(3))
295304
true

0 commit comments

Comments
 (0)