Class: Prime::EratosthenesGenerator

### Home Classes Methods

### In Files

- lib/backports/1.9.1/stdlib/prime.rb

### Parent

Prime::PseudoPrimeGenerator

### Methods

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

### Class/Module Index

Quicksearch

- Prime
- Prime::EratosthenesGenerator
- Prime::EratosthenesSieve
- Prime::Generator23
- Prime::OldCompatibility
- Prime::PseudoPrimeGenerator
- Prime::TrialDivision
- Prime::TrialDivisionGenerator
- Backports
- Backports::MOST_EXTREME_OBJECT_EVER
- Backports::Random
- Backports::Random::Implementation
- Backports::Random::MT19937
- Backports::StdLib
- Backports::StdLib::LoadedFeatures
- Enumerator
- Enumerator::GeneratorBP
- Enumerator::Lazy
- Enumerator::Yielder
- Matrix
- Matrix::EigenvalueDecomposition
- Matrix::LUPDecomposition
- Enumerable
- Enumerable::Enumerator
- File
- File::Constants
- ARGF
- Array
- BasicObject
- Bignum
- Binding
- Complex
- Dir
- ENV
- Fixnum
- Float
- GC
- Hash
- IO
- Integer
- Kernel
- Math
- Method
- Module
- NilClass
- Numeric
- Object
- ObjectSpace
- OpenStruct
- Proc
- Process
- Random
- Range
- Regexp
- Set
- StopIteration
- String
- Struct
- Symbol
- UnboundMethod

No matching classes.

# Prime::EratosthenesGenerator

An implementation of `PseudoPrimeGenerator`.

Uses `EratosthenesSieve`.

### Public Class Methods

new() click to toggle source

    # File lib/backports/1.9.1/stdlib/prime.rb, line 292
    def initialize
      @last_prime = nil
      super
    end

### Public Instance Methods

next() click to toggle source
Alias for: succ
rewind() click to toggle source

    # File lib/backports/1.9.1/stdlib/prime.rb, line 300
    def rewind
      initialize
    end

succ() click to toggle source

    # File lib/backports/1.9.1/stdlib/prime.rb, line 297
    def succ
      @last_prime = @last_prime ? EratosthenesSieve.instance.next_to(@last_prime) : 2
    end

Also aliased as: next

[Validate]

Generated with the Darkfish Rdoc Generator 2.