Sha256: 4f5f53851053c839249a117c87492325be980ca3be5463cb888370be56d33a03

Contents?: true

Size: 579 Bytes

Versions: 12

Compression:

Stored size: 579 Bytes

Contents

describe Integer, "#carmichael?" do
  # A002997
  @seq = [561,1105,1729,2465,2821,6601,8911,10585,15841,
          29341,41041,46657,52633,62745,63973,75361,101101,
          115921,126217,162401,172081,188461,252601,278545,
          294409,314821,334153,340561,399001,410041,449065,
          488881,512461].to_seq

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

  @seq.invert.sample(10).each do |n| 
    it "returns false for non-Carmichael number #{n}" do
      n.should_not be_carmichael
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
numb-0.114.0 spec/numb/carmichael_spec.rb
numb-0.111.0 spec/numb/carmichael_spec.rb
numb-0.109.0 spec/numb/carmichael_spec.rb
numb-0.99.0 spec/numb/carmichael_spec.rb
numb-0.96.0 spec/numb/carmichael_spec.rb
numb-0.89.0 spec/numb/carmichael_spec.rb
numb-0.84.0 spec/carmichael_spec.rb
numb-0.77.0 spec/carmichael_spec.rb
numb-0.72.1 spec/carmichael_spec.rb
numb-0.72.0 spec/carmichael_spec.rb
numb-0.68.0 spec/carmichael_spec.rb
numb-0.63.0 spec/carmichael_spec.rb