2017年1月9日月曜日

170109(2)

Ruby


二項係数の二乗の性質について(4)

二項係数の二乗に関する次の式を確認してみる。

binomial(2n, n) = Sum_{k=0..n} binomial(n, k)^2
binomial(3n, n)^2 = Sum_{k=0..n} binomial(n, k)^2 * binomial(3n + k, 2n)

二つ目の式は、Doron Zeilberger さんの写真で知った。

def ncr(n, r)
  return 1 if r == 0
  (n - r + 1..n).inject(:*) / (1..r).inject(:*)
end

n = 50
(0..n).each{|i|
  k = (0..i).inject(0){|s, j| s += ncr(i, j) ** 2}
  p [i, k, k == ncr(2 * i, i)]
}
(0..n).each{|i|
  k = (0..i).inject(0){|s, j| s += ncr(i, j) ** 2 * ncr(3 * i + j, 2 * i)}
  p [i, k, k == ncr(3 * i, i) ** 2]
}

出力結果
[0, 1, true]
[1, 2, true]
[2, 6, true]
[3, 20, true]
[4, 70, true]
[5, 252, true]
[6, 924, true]
[7, 3432, true]
[8, 12870, true]
[9, 48620, true]
[10, 184756, true]
[11, 705432, true]
[12, 2704156, true]
[13, 10400600, true]
[14, 40116600, true]
[15, 155117520, true]
[16, 601080390, true]
[17, 2333606220, true]
[18, 9075135300, true]
[19, 35345263800, true]
[20, 137846528820, true]
[21, 538257874440, true]
[22, 2104098963720, true]
[23, 8233430727600, true]
[24, 32247603683100, true]
[25, 126410606437752, true]
[26, 495918532948104, true]
[27, 1946939425648112, true]
[28, 7648690600760440, true]
[29, 30067266499541040, true]
[30, 118264581564861424, true]
[31, 465428353255261088, true]
[32, 1832624140942590534, true]
[33, 7219428434016265740, true]
[34, 28453041475240576740, true]
[35, 112186277816662845432, true]
[36, 442512540276836779204, true]
[37, 1746130564335626209832, true]
[38, 6892620648693261354600, true]
[39, 27217014869199032015600, true]
[40, 107507208733336176461620, true]
[41, 424784580848791721628840, true]
[42, 1678910486211891090247320, true]
[43, 6637553085023755473070800, true]
[44, 26248505381684851188961800, true]
[45, 103827421287553411369671120, true]
[46, 410795449442059149332177040, true]
[47, 1625701140345170250548615520, true]
[48, 6435067013866298908421603100, true]
[49, 25477612258980856902730428600, true]
[50, 100891344545564193334812497256, true]
[0, 1, true]
[1, 9, true]
[2, 225, true]
[3, 7056, true]
[4, 245025, true]
[5, 9018009, true]
[6, 344622096, true]
[7, 13521038400, true]
[8, 540917591841, true]
[9, 21966328580625, true]
[10, 902702926350225, true]
[11, 37456461988358400, true]
[12, 1566697064677290000, true]
[13, 65973795093338597136, true]
[14, 2794203818390077646400, true]
[15, 118933541228935777741056, true]
[16, 5084343623375056062840609, true]
[17, 218184481964802925571225625, true]
[18, 9394717048781243503863746025, true]
[19, 405748577172828446758090890000, true]
[20, 17571560360851714604758772195025, true]
[21, 762833211945304545066461934411225, true]
[22, 33190706695870327778227083008160000, true]
[23, 1447057367826698239985795843065881600, true]
[24, 63206660495682595624549330402589610000, true]
[25, 2765555290416839473031167204408459002384, true]
[26, 121195487631174633730927833544205257600656, true]
[27, 5318924889969443115310808620611069447398400, true]
[28, 233748495106736101786894895229641645789550144, true]
[29, 10285381108241623881916309820274516510629889600, true]
[30, 453108001368076310715667906944152961974817444096, true]
[31, 19982951354103292701454572015101140735385991373824, true]
[32, 882193820771900502535643811498546758648049058152225, true]
[33, 38984103955797136681279773419449309622062504973658249, true]
[34, 1724270438887994625834515280849063987966324698709200625, true]
[35, 76329911458638224452349090775329585231892494150920688400, true]
[36, 3381698334791469437004948003407442741034218709339939869225, true]
[37, 149936227529339926917553100548615791741885760141533899450625, true]
[38, 6652613763672283466013184106680268742762004160256359658170256, true]
[39, 295376420253712173831277560006115570812668377461927841585358400, true]
[40, 13123271479819978574664406818529563852092776645195540137756485841, true]
[41, 583414585018079792619433970761875763379742907122734367278277407649, true]
[42, 25951856488640880866128457426128287211789727159727599555822160140625, true]
[43, 1155057402258485564982733922763563747848191972170069391447847549440000, true]
[44, 51436513521060993435798859696436264469919974735768503830383977124000000, true]
[45, 2291721712560872550292226191948436363553183458985498289746618685729440000, true]
[46, 102156240196159152625674321430240318894926071994134772320778403545682560000, true]
[47, 4555871619915950611944232710538054608079729891901648156061887454566976000000, true]
[48, 203269900254193422158434741036864998800648156620681866622845989348639415210000, true]
[49, 9073224976364316856806085028235013912491582743797193661522250038080669492250000, true]
[50, 405162990018970340199751908160171239022527655331073364452340925866141007913459600, true]

0 件のコメント:

コメントを投稿