Class: FundingPrimer::Prime
- Inherits:
-
Object
- Object
- FundingPrimer::Prime
- 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
-
.first(n, generator = TrialDivisionGenerator.new) ⇒ Object
Generates the first
n
prime numbers.
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 |