Anonymous user
Miller–Rabin primality test: Difference between revisions
→This is a correct M-R test implementation for using bases > input.
Line 4,569:
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
return primes.include? self if self <= primes.last
modp47 =
return false if self.gcd(modp47) != 1 # eliminates 86.2% of all integers
# Choose witness bases for input; wits = [range, [wit_bases]] or nil
|