Skip to content

Commit 699263b

Browse files
authored
use integermathutils
1 parent bd3e052 commit 699263b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Primes.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ using Base.Iterators: repeated
77
import Base: iterate, eltype, IteratorSize, IteratorEltype
88
using Base: BitSigned
99
using Base.Checked: checked_neg
10+
using IntegerMathUtils
1011

1112
export isprime, primes, primesmask, factor, ismersenneprime, isrieselprime,
1213
nextprime, nextprimes, prevprime, prevprimes, prime, prodfactors, radical, totient
@@ -176,11 +177,7 @@ julia> isprime(big(3))
176177
true
177178
```
178179
"""
179-
isprime(x::BigInt, reps=25) = ccall((:__gmpz_probab_prime_p,:libgmp),
180-
Cint, (Any, Cint), x, reps) > 0
181-
# TODO: Change `Any` to `Ref{BigInt}` when 0.6 support is dropped.
182-
# The two have the same effect but `Ref{BigInt}` won't be optimized on 0.6.
183-
180+
isprime(x::BigInt, reps=25) = is_probably_prime(x, reps)
184181

185182
# Miller-Rabin witness choices based on:
186183
# http://mathoverflow.net/questions/101922/smallest-collection-of-bases-for-prime-testing-of-64-bit-numbers

0 commit comments

Comments
 (0)