Sha256: d002a10b6d8c902500cb511df7322740946b941dcd94cdd5d527af93343c33c8

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

# coding: utf-8
describe Integer, "#inrt" do
  @seq = {
    # A017922
    2 => [1,2,6,14,36,88,216,529,1296,3174,7776,19047,
          46656,114283,279936,685700,1679616,4114202,
          10077696,24685212,60466176,148111277,362797056,
          888667667,2176782336,5332006004,13060694016].map.with_index{|n,i| [6**i, n]},
    
    # A017985
    3 => [1,1,2,4,6,10,16,25,40,64,101,161,256,406,645,
          1024,1625,2580,4096,6501,10321,16384,26007,41285,
          65536,104031,165140,262144,416127,660561,1048576,
          1664510,2642245,4194304,6658042].map.with_index{|n,i| [4**i, n]},
    
    # A018051
    4 => [1,1,1,2,3,3,5,6,9,11,15,20,27,35,46,61,81,106,
          140,184,243,319,420,553,729,959,1262,1661,2187,
          2878,3787,4985,6561,8634,11363,14955,19683,25904,
          34091,44867,59049,77712].map.with_index{|n,i| [3**i, n]},

    # A018132
    5 => [1,1,2,3,4,7,10,15,22,33,49,72,106,157,232,343,
          506,747,1102,1626,2401,3543,5229,7717,11388,16807,
          24803,36604,54019,79720,117649,173623,256228,
          378135,558041,823543].map.with_index{|n,i| [7**i, n]},
    
    # A017979 
    6 => [1,1,1,2,2,3,4,5,6,8,10,12,16,20,25,32,40,50,64,
          80,101,128,161,203,256,322,406,512,645,812,1024,
          1290,1625,2048,2580,3250,4096,5160,6501,8192,
          10321,13003,16384,20642].map.with_index{|n,i| [4**i, n]},
 }

  @seq.each do |n, seq|
    seq.each do |x, rt|
      it "returns #{rt} for #{x}.inrt(#{n})" do
        x.inrt(n).should == rt 
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numb-0.186.0 spec/numb/inrt_spec.rb
numb-0.185.0 spec/numb/inrt_spec.rb
numb-0.184.0 spec/numb/inrt_spec.rb