# coding: utf-8
describe Integer, "#lah" do
  @seq = {
    # A000142
    1 => [1,1,2,6,24,120,720,5040,40320,362880,3628800,
          39916800,479001600,6227020800,87178291200,
          1307674368000,20922789888000,355687428096000,
          6402373705728000,121645100408832000,
          2432902008176640000][1..-1],
    # A001286
    2 => [1,6,36,240,1800,15120,141120,1451520,16329600,
          199584000,2634508800,37362124800,566658892800,
          9153720576000,156920924160000,2845499424768000,
          54420176498688000,1094805903679488000,
          23112569077678080000],
    # A001754
    3 => [0,0,1,12,120,1200,12600,141120,1693440,21772800,
          299376000,4390848000,68497228800,1133317785600,
          19833061248000,366148823040000,7113748561920000,
          145120470663168000,3101950060425216000,
          69337707233034240000,1617879835437465600000].reject(&:zero?),
    # A001755 
    4 => [1,20,300,4200,58800,846720,12700800,199584000,
          3293136000,57081024000,1038874636800,
          19833061248000,396661224960000,8299373322240000,
          181400588328960000,4135933413900288000,
          98228418580131840000],
    # A001777
    5 => [1,30,630,11760,211680,3810240,69854400,
          1317254400,25686460800,519437318400,
          10908183686400,237996734976000,5394592659456000,
          126980411830272000,3101950060425216000,
          78582734864105472000],
    # A001778
    6 => [1,42,1176,28224,635040,13970880,307359360,
          6849722880,155831195520,3636061228800,
          87265469491200,2157837063782400,55024845126451200,
          1447576694865100800,39291367432052736000,
          1100158288097476608000],
    # A111597
    7 => [1,56,2016,60480,1663200,43908480,1141620480,
          29682132480,779155977600,20777492736000,
          565147802419200,15721384321843200,
          448059453172531200,13097122477350912000,
          392913674320527360000,12101741169072242688000],
    }

  @seq.each do |k, values|
    (1...k).each do |n|
      it "returns 0 for Lah(#{n}, #{k})" do
        n.lah(k).should be_zero 
      end
    end

    values.to_enum.with_index(k).each do |lah, n|
      it "returns #{lah} for Lah(#{n}, #{k})" do
        n.lah(k).should == lah
      end
    end
  end
end
