Class: FundingPrimer::Prime

Inherits:
Object
  • Object
show all
Defined in:
lib/funding_primer/prime.rb

Overview

FundingPrimer::Prime encapsulates the logic to generate prime numbers

Defined Under Namespace

Classes: BaseGenerator, PrimorialGenerator, TrialDivisionGenerator

Class Method Summary collapse

Class Method Details

.first(n, generator = TrialDivisionGenerator.new) ⇒ Object

Generates the first n prime numbers. For example:

FundingPrimer::Prime.first(3)
# => [2,3,5]


8
9
10
# File 'lib/funding_primer/prime.rb', line 8

def self.first(n, generator=TrialDivisionGenerator.new)
  generator.first(n)
end