Sha256: 12d2780c43d1d1dd669a4d8cf75c34d47fbf574f6d0e39b2cf2f11d623990fdd

Contents?: true

Size: 649 Bytes

Versions: 5

Compression:

Stored size: 649 Bytes

Contents

describe Integer, "#highly_composite?" do
  # A002182
  @seq = [1,2,4,6,12,24,36,48,60,120,180,240,360,720,840,
          1260,1680,2520,5040,7560,10080,15120,20160,25200,
          27720,45360,50400,55440,83160,110880,166320,
          221760,277200,332640,498960,554400,665280,720720,
          1081080,1441440,2162160].to_seq

  @seq.first(18).sample(10).each do |n|
    it "should return true for highly composite integer #{n}" do
      n.should be_highly_composite
    end
  end

  @seq.invert.sample(10).each do |n|
    it "should return false for non-highly composite integer #{n}" do
      n.should_not be_highly_composite
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
numb-0.186.0 spec/numb/highly_composite_spec.rb
numb-0.185.0 spec/numb/highly_composite_spec.rb
numb-0.184.0 spec/numb/highly_composite_spec.rb
numb-0.181.0 spec/numb/highly_composite_spec.rb
numb-0.170.0 spec/numb/highly_composite_spec.rb