Sha256: 2c1e5066edff0bc85101ddec5eb3c5f14634a01bf0d74434e5406b9e33379a52

Contents?: true

Size: 672 Bytes

Versions: 20

Compression:

Stored size: 672 Bytes

Contents

describe Integer, "#abundant?" do
  # A005101
  @seq = [12,18,20,24,30,36,40,42,48,54,56,60,66,70,72,78,
          80,84,88,90,96,100,102,104,108,112,114,120,126,
          132,138,140,144,150,156,160,162,168,174,176,180,
          186,192,196,198,200,204,208,210,216,220,222,224,
          228,234,240,246,252,258,260,264,270].to_seq

  @seq.each do |n|
    it "returns true for abundant number #{n}" do
      n.should be_abundant
    end

    it "returns false for negative number #{-n}" do
      (-n).should_not be_abundant
    end
  end

  @seq.invert.each do |n|
    it "returns false for non-abundant number #{n}" do
      n.should_not be_abundant
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
numb-0.186.0 spec/numb/abundant_spec.rb
numb-0.185.0 spec/numb/abundant_spec.rb
numb-0.184.0 spec/numb/abundant_spec.rb
numb-0.181.0 spec/numb/abundant_spec.rb
numb-0.170.0 spec/numb/abundant_spec.rb
numb-0.152.0 spec/numb/abundant_spec.rb
numb-0.138.0 spec/numb/abundant_spec.rb
numb-0.125.0 spec/numb/abundant_spec.rb
numb-0.114.0 spec/numb/abundant_spec.rb
numb-0.111.0 spec/numb/abundant_spec.rb
numb-0.109.0 spec/numb/abundant_spec.rb
numb-0.99.0 spec/numb/abundant_spec.rb
numb-0.96.0 spec/numb/abundant_spec.rb
numb-0.89.0 spec/numb/abundant_spec.rb
numb-0.84.0 spec/abundant_spec.rb
numb-0.77.0 spec/abundant_spec.rb
numb-0.72.1 spec/abundant_spec.rb
numb-0.72.0 spec/abundant_spec.rb
numb-0.68.0 spec/abundant_spec.rb
numb-0.63.0 spec/abundant_spec.rb