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