Sha256: 054214315e2620aeaeb64bd6cf71e12948f83186098edca700af93eacefc7b84
Contents?: true
Size: 775 Bytes
Versions: 11
Compression:
Stored size: 775 Bytes
Contents
# A034386 PRIMORIAL = [1,2,6,6,30,30,210,210,210,210,2310,2310,30030, 30030,30030,30030,510510,510510,9699690,9699690, 9699690,9699690,223092870,223092870,223092870, 223092870,223092870,223092870,6469693230, 6469693230] describe Integer, "#primorial" do PRIMORIAL.each_with_index do |n,i| i = i.succ it "should return #{n} for #{i}" do i.primorial.should == n end end end describe Integer, "#primorial?" do PRIMORIAL.uniq.each do |n| it "should return true for primorial number #{n}" do n.should be_primorial end end PRIMORIAL.to_seq.invert.first(20).each do |n| it "should return false for non-primorial number #{n}" do n.should_not be_primorial end end end
Version data entries
11 entries across 11 versions & 1 rubygems