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