Class: Prime::TrialDivisionGenerator (Ruby 2.4.2)
Description: Class : Prime::TrialDivisionGenerator - Ruby 2.4.2

Support for the Ruby 2.4 series has ended. See here for reference.

### Home Classes Methods

### In Files

- prime.rb

### Parent

Prime::PseudoPrimeGenerator

### Methods

- ::new
- #next
- #rewind
- #succ

### Class/Module Index

Quicksearch

- Integer
- Prime
- Prime::EratosthenesGenerator
- Prime::EratosthenesSieve
- Prime::Generator23
- Prime::PseudoPrimeGenerator
- Prime::TrialDivision
- Prime::TrialDivisionGenerator

No matching classes.

# 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 328
    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 336
    def rewind
      initialize
    end

succ() click to toggle source

                   # File prime.rb, line 333
    def succ
      TrialDivision.instance[@index += 1]
    end

Also aliased as: next