Maintenance of Ruby 2.0.0 ended on February 24, 2016. Read more

- prime.rb

Object

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

prime?()
click to toggle source

Returns true if `self`

is a prime number, false for a composite.

# 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

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.