123456789_123456789_123456789_123456789_123456789_

Class: Integer

Relationships & Source Files
Inherits: Object
Defined in: lib/prime.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Class Method Details

.each_prime(ubound, &block)

Iterates the given block over all prime numbers.

See ::Prime#each for more details.

[ GitHub ]

  
# File 'lib/prime.rb', line 40

def Integer.each_prime(ubound, &block) # :yields: prime
  Prime.each(ubound, &block)
end

.from_prime_division(pd)

Re-composes a prime factorization and returns the product.

See Prime#int_from_prime_division for more details.

[ GitHub ]

  
# File 'lib/prime.rb', line 21

def Integer.from_prime_division(pd)
  Prime.int_from_prime_division(pd)
end

Instance Attribute Details

#prime?Boolean (readonly)

Returns true if self is a prime number, else returns false.

[ GitHub ]

  
# File 'lib/prime.rb', line 33

def prime?
  Prime.prime?(self)
end

Instance Method Details

#prime_division(generator = Prime::Generator23.new)

Returns the factorization of self.

See Prime#prime_division for more details.

[ GitHub ]

  
# File 'lib/prime.rb', line 28

def prime_division(generator = Prime::Generator23.new)
  Prime.prime_division(self, generator)
end