Class: Integer (Ruby 2.2.4)
Description: Class : Integer - Ruby 2.2.4

- Home
- Core 2.2.4
- Std-lib 2.2.4
- Downloads

Support for the Ruby 2.2 series has ended. See here for reference.

### Home Classes Methods

### In Files

- prime.rb

### Parent

Object

### Methods

- ::each_prime
- ::from_prime_division
- #prime?
- #prime_division

### Class/Module Index

Quicksearch

- Integer
- Prime
- Prime::EratosthenesGenerator
- Prime::EratosthenesSieve
- Prime::Generator23
- Prime::OldCompatibility
- Prime::PseudoPrimeGenerator
- Prime::TrialDivision
- Prime::TrialDivisionGenerator

No matching classes.

# Integer

### Public Class Methods

each_prime(ubound) click to toggle source

Iterates the given block over all prime numbers.

See `Prime`#each for more details.

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

from_prime_division(pd) click to toggle source

Re-composes a prime factorization and returns the product.

See Prime#int_from_prime_division for more details.

                   # File prime.rb, line 21
    def Integer.from_prime_division(pd)
      Prime.int_from_prime_division(pd)
    end

### Public Instance Methods

prime?() click to toggle source

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

                   # File prime.rb, line 33
    def prime?
      Prime.prime?(self)
    end

prime_division(generator = Prime::Generator23.new) click to toggle source

Returns the factorization of `self`.

See Prime#prime_division for more details.

                   # File prime.rb, line 28
    def prime_division(generator = Prime::Generator23.new)
      Prime.prime_division(self, generator)
    end