Sha256: c1d2b726bab393e86a9bf4883968203cc7387a6357004d992513486ffde4bcb4

Contents?: true

Size: 792 Bytes

Versions: 5

Compression:

Stored size: 792 Bytes

Contents

# A002203
PELL_LUCAS = [2,2,6,14,34,82,198,478,1154,2786,6726,16238,
              39202,94642,228486,551614,1331714,3215042,7761798,
              18738638,45239074,109216786,263672646,636562078,
              1536796802,3710155682,8957108166,21624372014,
              52205852194]

describe Integer, "#pell_lucas?" do
  PELL_LUCAS.each do |n|
    it "returns true for Pell-Lucas number #{n}" do
      n.should be_pell_lucas
    end
  end

  PELL_LUCAS.to_seq.invert.sample(10).each do |n|
    it "returns false for non-Pell-Lucas number #{n}" do
      n.should_not be_pell_lucas
    end
  end
end

describe Integer, "#pell_lucas" do
  PELL_LUCAS.each_with_index do |l, n|
    it "returns #{l} for the #{n}#{n.ordinal} Pell-Lucas number" do
      n.pell_lucas.should == l
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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