Anonymous user
Miller–Rabin primality test: Difference between revisions
→This is a correct M-R test implementation for using bases > input.
Line 1,080:
modp47 = 614_889_782_588_491_410.to_big_i # => primes.product, largest < 2^64
return false if modp47.gcd(self.to_big_i) != 1 # eliminates 86.2% of all integers
# Choose input witness bases
wits = WITNESS_RANGES.find { |range, wits| range > self }
witnesses = wits && wits[1] || primes
|