An implementation of PseudoPrimeGenerator
.
Uses EratosthenesSieve
.
Class Methods
::
lib/prime.rb
View on GitHub
# File tmp/rubies/ruby-2.4.10/lib/prime.rb, line 310
def initialize
@last_prime_index = -1
super
end
No documentation available
Instance Methods
#
lib/prime.rb
View on GitHub
# File tmp/rubies/ruby-2.4.10/lib/prime.rb, line 319
def rewind
initialize
end
No documentation available
#
lib/prime.rb
View on GitHub
# File tmp/rubies/ruby-2.4.10/lib/prime.rb, line 315
def succ
@last_prime_index += 1
EratosthenesSieve.instance.get_nth_prime(@last_prime_index)
end
No documentation available