yugui
7287b852da
* lib/prime.rb (Prime#prime_division): now decomposes
...
negative integer into a decomposition with element [-1, 1].
* test/test_prime.rb: test for it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 13:51:49 +00:00
nobu
287a34ae0d
* {ext,lib,test}/**/*.rb: removed trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
yugui
294f45b0fc
* lib/prime.rb (Prime::prime?): used to return a wrong answer.
...
[ruby-core:22646].
* test/test_prime.rb (test_prime?): test case for [ruby-core:22646].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-03 15:57:15 +00:00
yugui
fce093432e
* lib/mathn.rb (Integer): moved into prime.rb.
...
(Prime): ditto.
* lib/prime.rb (Integer): moved from mathn.rb.
(Integer.each_prime): added.
(Integer#prime?): added.
(Prime): moved from mathn.rb.
Its implmentation was rewritten. see [ruby-dev:35863].
And patched by Keiju ISHITSUKA <keiju@ishitsuka.com>,
see [ruby-dev:36128].
(Prime.new): obsolete.
(Prime.instance): added.
(Prime.each): added.
(Prime.int_from_prime_division): added.
(Prime.prime_division): added.
(Prime.prime?): added.
Patch by TOYOFUKU Chikanobu
<nobu_toyofuku at nifty.com> in [ruby-dev:36067].
(Prime.cache): removed.
(Prime.primes): removed.
(Prime.primes_so_far): removed.
(Prime#int_from_prime_division): added.
(Prime#prime_division): added.
(Prime#prime?): added.
(Prime#primes): removed.
(Prime#primes_so_far): removed.
(Prime::PseudoPrmeGenerator): added.
(Prime::EratosthenesGenerator): added.
(Prime::TrialDivisionGenerator): added.
(Prime::Generator23): added.
(Prime::TrialDivision): added.
Extracted from the previous implementation of Prime
by Keiju ISHITSUKA.
(Prime::EratosthenesSieve): added.
* lib/.document (prime.rb): added
* lib/README (prime.rb): added
* test/test_prime.rb: added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-03 13:57:21 +00:00