Sha256: fd5f0ee3974469544f58b986cf7fb42cedb00bd9169107fab2dd9c76283456f7
Contents?: true
Size: 546 Bytes
Versions: 22
Compression:
Stored size: 546 Bytes
Contents
describe Integer, "#pentagonal?" do PENTAGONAL = [0,1,5,12,22,35,51,70,92,117,145,176,210,247,287, 330,376,425,477,532,590,651,715,782,852,925,1001, 1080,1162,1247,1335,1426,1520,1617,1717,1820,1926, 2035,2147,2262,2380,2501,2625,2752,2882,3015,3151] it "returns true for pentagonal numbers" do PENTAGONAL.each{|n| n.should be_pentagonal} end it "returns false for non-pentagonal numbers" do ((0..PENTAGONAL.last).to_a - PENTAGONAL).each{|n| n.should_not be_pentagonal} end end
Version data entries
22 entries across 22 versions & 1 rubygems