Class: Prime

Inherits:
Object
  • Object
show all
Defined in:
lib/tonal/extensions.rb

Class Method Summary collapse

Class Method Details

.within(lower = 0, upper) ⇒ Array

Returns the primes within lower and upper bounds.

Examples:

Prime.within(6, 14) => [7, 11, 13]

Parameters:

  • lower (defaults to: 0)

    bound

  • upper

    bound

Returns:

  • (Array)

    the primes within lower and upper bounds



8
# File 'lib/tonal/extensions.rb', line 8

def self.within(lower=0, upper) = self.each(upper).reject{|p| p < lower}