In Files

  • prime.rb

Prime::TrialDivisionGenerator

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

Public Class Methods

new() click to toggle source
 
               # File prime.rb, line 355
def initialize
  @index = -1
  super
end
            

Public Instance Methods

next() click to toggle source
Alias for: succ
rewind() click to toggle source
 
               # File prime.rb, line 363
def rewind
  initialize
end
            
succ() click to toggle source
 
               # File prime.rb, line 360
def succ
  TrialDivision.instance[@index += 1]
end
            
Also aliased as: next