class Prime::TrialDivisionGenerator

Parent:
Prime::PseudoPrimeGenerator

An implementation of PseudoPrimeGenerator which uses a prime table generated by trial division.

Public Class Methods

new() Show source
# File lib/prime.rb, line 325
def initialize
  @index = -1
  super
end
Calls superclass method Prime::PseudoPrimeGenerator.new

Public Instance Methods

next()
Alias for: succ
rewind() Show source
# File lib/prime.rb, line 333
def rewind
  initialize
end
succ() Show source
# File lib/prime.rb, line 330
def succ
  TrialDivision.instance[@index += 1]
end
Also aliased as: next

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.