Sha256: 259039ec7331c7ebc0108161a11bd2514e42ce4214cdc5800a14f39171b5d305
Contents?: true
Size: 1.6 KB
Versions: 5
Compression:
Stored size: 1.6 KB
Contents
# coding: utf-8 describe Integer, "#pyramidal" do @seq = { # A002411 5 => [0,1,6,18,40,75,126,196,288,405,550,726,936,1183, 1470,1800,2176,2601,3078,3610,4200,4851,5566,6348, 7200,8125,9126,10206,11368,12615,13950,15376, 16896,18513,20230,22050,23976,26011,28158,30420, 32800,35301][1..-1], # A002413 7 => [1,8,26,60,115,196,308,456,645,880,1166,1508,1911, 2380,2920,3536,4233,5016,5890,6860,7931,9108, 10396,11800,13325,14976,16758,18676,20735,22940, 25296,27808,30481,33320,36330,39516,42883,46436, 50180,54120], # A002414 8 => [1,9,30,70,135,231,364,540,765,1045,1386,1794, 2275,2835,3480,4216,5049,5985,7030,8190,9471, 10879,12420,14100,15925,17901,20034,22330,24795, 27435,30256,33264,36465,39865,43470,47286,51319, 55575,60060,64780], # A007586 11 => [0,1,12,42,100,195,336,532,792,1125,1540,2046, 2652,3367,4200,5160,6256,7497,8892,10450,12180, 14091,16192,18492,21000,23725,26676,29862,33292, 36975,40920,45136,49632,54417,59500][1..-1], # A130566 47 => [1,48,186,460,915,1596,2548,3816,5445,7480,9966, 12948,16471,20580,25320,30736,36873,43776,51490, 60060,69531,79948,91356,103800,117325,131976, 147798,164836,183135,202740,223696,246048,269841, 295120,321930,350316,380323] } @seq.each do |k, ns| ns.to_enum.with_index(1).each do |py, n| it "returns #{py} for #{k}-pyramidal number #{n}" do n.pyramidal(k).should == py end end end end
Version data entries
5 entries across 5 versions & 1 rubygems