class Prime::EratosthenesGenerator

An implementation of PseudoPrimeGenerator.

Uses EratosthenesSieve.

Public Class Methods

new() click to toggle source
Calls superclass method Prime::PseudoPrimeGenerator::new
# File prime-0.1.3/lib/prime.rb, line 411
def initialize
  @last_prime_index = -1
  super
end

Public Instance Methods

next()
Alias for: succ
rewind() click to toggle source
# File prime-0.1.3/lib/prime.rb, line 420
def rewind
  initialize
end
succ() click to toggle source
# File prime-0.1.3/lib/prime.rb, line 416
def succ
  @last_prime_index += 1
  EratosthenesSieve.instance.get_nth_prime(@last_prime_index)
end
Also aliased as: next