Sha256: 49b5a2d267a9c33aa5fa65f2a1eb20e84c2da0e0a9da9093ca0786bda69b08b7
Contents?: true
Size: 729 Bytes
Versions: 20
Compression:
Stored size: 729 Bytes
Contents
describe Integer, "#coprime?" do # A053674 @seq = [7,11,11,11,11,13,13,7,17,17,17,11,11,11,7,11,13, 13,13,13,17,7,11,11,11,11,11,13,7,13,13,13,13,11, 11,7,11,11,17,13,13,13,7,13,11,11,11,11,11,7,19, 17,13,13,13,11,7,11,11,11,17,17,19,7,19,13,11,11, 11,11,7,13] @seq.each_slice(2) do |a, b| next if a == b it "should return true for co-prime pair #{a} and #{b}" do a.coprime?(b).should be_true end c = a * rand(100) d = b * c it "should return false for non-co-prime pair #{c} and #{d}" do c.coprime?(d).should be_false end end it "should return false if self is equal to the argument" do 3.coprime?(3).should be_false end end
Version data entries
20 entries across 20 versions & 1 rubygems