Class: Prime::MillerRabin
- Inherits:
-
PseudoPrimeGenerator
- Object
- PseudoPrimeGenerator
- Prime::MillerRabin
- Defined in:
- lib/prime_miller_rabin/version.rb,
lib/prime_miller_rabin.rb
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.make_default ⇒ Object
9 10 11 12 |
# File 'lib/prime_miller_rabin.rb', line 9 def self.make_default Prime.send(:prepend, Prime::MillerRabin::Default::Prime, Prime::MillerRabin::PrimeIntercept) Integer.send(:prepend, Prime::MillerRabin::Default::Integer) end |
.speed_intercept ⇒ Object
5 6 7 |
# File 'lib/prime_miller_rabin.rb', line 5 def self.speed_intercept Prime.send(:prepend, Prime::MillerRabin::PrimeIntercept) end |
Instance Method Details
#prime?(x) ⇒ Boolean
22 23 24 |
# File 'lib/prime_miller_rabin.rb', line 22 def prime?(x) miller_rabin(x) end |
#rewind ⇒ Object
18 19 20 |
# File 'lib/prime_miller_rabin.rb', line 18 def rewind() self.last_prime = nil end |
#succ ⇒ Object
14 15 16 |
# File 'lib/prime_miller_rabin.rb', line 14 def succ() self.last_prime = next_prime(last_prime || 1) end |