Sha256: 8cf2b37464514dd621e8418ff5aaf1b806b272e9e7f3a6ecc055355ee6fd8c43

Contents?: true

Size: 138 Bytes

Versions: 8

Compression:

Stored size: 138 Bytes

Contents

class Integer
  def goldbach?
    return false unless even? and self > 2
    downto(2).any?{|n| n.prime? and (self - n).prime?}
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
numb-0.138.0 lib/numb/goldbach.rb
numb-0.125.0 lib/numb/goldbach.rb
numb-0.114.0 lib/numb/goldbach.rb
numb-0.111.0 lib/numb/goldbach.rb
numb-0.109.0 lib/numb/goldbach.rb
numb-0.99.0 lib/numb/goldbach.rb
numb-0.96.0 lib/numb/goldbach.rb
numb-0.89.0 lib/numb/goldbach.rb