Miller–Rabin primality test: Difference between revisions

Line 1,058:
puts 341531.prime? # => false</lang>
 
=== This is a correct M-R test implementation for using bases > input. ===
==== It is a direct translation of the Ruby version for arbitrary sized integers. ====
==== It is deterministic for all integers < 3_317_044_064_679_887_385_961_981.====
<lang ruby># For crystal >= 0.31.x, compile without overflow check, as either
==== Increase 'primes' array members for more "confidence" past this value. ====
 
<lang ruby>
# For crystal >= 0.31.x, compile without overflow check, as either
# crystal build miller-rabin.cr -Ddisable_overflow --release
# crystal build -Ddisable_overflow miller-rabin.cr --release
Anonymous user