2件ヒット [1-2件を表示] （0.020秒）
トップページ > > > > :each > クラス:Prime > :prime

## 検索結果

### Prime#each(upper_bound = nil, generator = EratosthenesGenerator.new) {|prime| ... } -> object (106234.0)

...

=== 例:
require 'prime'
Prime
.each(6).each{|prime| prime } # => 5
Prime
.each(7).each{|prime| prime } # => 7
Prime
.each(10).each{|prime| prime } # => 7
Prime
.each(11).each{|prime| prime } # => 11

=== 例: 30以下の双子素数
require 'prime'
Prime
.each(30).each_cons(2).selec...
...素数とは限らない数列が発生します。
require 'prime'
Prime
.each(50, Prime::Generator23.new) do |n|
p n #=> [2, 3, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49]
end

@see Prime.each, Prime::EratosthenesGenerator, Prime::TrialDivisionGenerator, Prime::Generator23...

### Prime#each(upper_bound = nil, generator = EratosthenesGenerator.new) -> Enumerator (105934.0)

...

=== 例:
require 'prime'
Prime
.each(6).each{|prime| prime } # => 5
Prime
.each(7).each{|prime| prime } # => 7
Prime
.each(10).each{|prime| prime } # => 7
Prime
.each(11).each{|prime| prime } # => 11

=== 例: 30以下の双子素数
require 'prime'
Prime
.each(30).each_cons(2).selec...
...素数とは限らない数列が発生します。
require 'prime'
Prime
.each(50, Prime::Generator23.new) do |n|
p n #=> [2, 3, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49]
end

@see Prime.each, Prime::EratosthenesGenerator, Prime::TrialDivisionGenerator, Prime::Generator23...