Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed documentation of isprime(n::Integer) -> Bool #147

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/Primes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,14 @@ end
"""
isprime(n::Integer) -> Bool

Returns `true` if `n` is prime, and `false` otherwise.

Returns for values in the range of an INT64 variable: `true` if `n` is prime, and `false` otherwise
for bigger values: `true` if `n` is probably prime, and `false` otherwise (false-positive rate = 0.25^reps with reps=25 --> considerered safe)

More detailed:
for even numbers: returns deterministic and correct results
for values in the range of an INT64 variable: returns deterministic and correct results (by Lookup-tables, trial-division, Miller-Rabin, Lucas-Test)
for bigger values: returns probabilistic resultsfrom GNU Multiple Precision Arithmetic Library

```julia
julia> isprime(3)
true
Expand Down Expand Up @@ -290,6 +296,9 @@ end
Probabilistic primality test. Returns `true` if `x` is prime with high probability (pseudoprime);
and `false` if `x` is composite (not prime). The false positive rate is about `0.25^reps`.
`reps = 25` is considered safe for cryptographic applications (Knuth, Seminumerical Algorithms).

is_probably_prime is inherited from the module IntegerMathUtils that provides a wrapper to access
functionality from the GNU Multiple Precision Arithmetic Library (GMP) library
```julia
julia> isprime(big(3))
true
Expand Down