2017年4月23日日曜日

170423(2)

Ruby


(q^(-1/5) * R(q))^k

R(q) をRogers-Ramanujan continued fraction とし、
q^(-1/5) * R(q) のk乗を求めてみた。

def s(k, m, n)
  s = 0
  (1..n).each{|i| s += i if n % i == 0 && i % k == m}
  s
end

def A(k, n)
  ary = [1]
  a = [0] + (1..n).map{|i| s(5, 1, i) + s(5, 4, i) - s(5, 2, i) - s(5, 3, i)}
  (1..n).each{|i| ary << (1..i).inject(0){|s, j| s - k * a[j] * ary[-j]} / i}
  ary
end

n = 50
-12.upto(12){|i| p [i, A(i, n)]}

出力結果
[-12, [1, 12, 66, 208, 363, 144, -846, -1728, 273, 5940, 7152, -8544, -31328, -13896, 68286, 113248, -49716, -333708, -226980, 559776, 1088016, -205264, -2637306, -2072640, 3758552, 7937772, -573882, -17004528, -14235543, 21634056, 47763486, -563424, -94007685, -80925372, 110254230, 248894112, 5569776, -460233360, -400720638, 507688064, 1157634801, 49340880, -2040275052, -1781566800, 2146085694, 4908249776, 270470166, -8324985024, -7258290919, 8429111520, 19259764860]]
[-11, [1, 11, 55, 154, 220, -22, -682, -891, 946, 4015, 2310, -8700, -16753, 3982, 47729, 41536, -72864, -173580, -4411, 391622, 388960, -489566, -1300926, -169345, 2565915, 2682999, -2800094, -7881984, -1424555, 14187580, 15122822, -14100867, -40818041, -8405783, 68831499, 73713288, -63884645, -187221892, -41049074, 300402069, 321058441, -264775808, -778765691, -176168784, 1201506889, 1277513600, -1016869810, -2987754539, -686500551, 4464395892, 4715935928]]
[-10, [1, 10, 45, 110, 120, -98, -485, -340, 1045, 2320, -174, -6580, -6995, 9120, 26970, 5998, -56950, -69760, 59785, 209470, 67523, -380000, -487155, 337020, 1282540, 466352, -2104240, -2734190, 1663345, 6599200, 2510530, -10102740, -13118530, 7380420, 29800970, 11533800, -43312975, -55908670, 29856435, 121296270, 47153292, -169326330, -216794900, 111693820, 453639990, 176106794, -612918540, -777964670, 390448770, 1580419670, 610948982]]
[-9, [1, 9, 36, 75, 54, -117, -303, -27, 855, 1087, -1080, -4041, -1635, 8100, 12060, -6588, -33219, -17064, 55029, 86139, -35343, -205974, -111996, 305973, 482736, -167859, -1053612, -581959, 1450638, 2277414, -720987, -4671711, -2576943, 6093534, 9473373, -2824029, -18545583, -10165032, 23196852, 35678328, -10227222, -67350339, -36601215, 81483183, 124005132, -34570244, -227236941, -122408271, 267459084, 403024239, -110094912]]
[-8, [1, 8, 28, 48, 14, -104, -160, 112, 573, 336, -1112, -2000, 602, 5192, 3680, -7776, -14970, 2520, 32680, 23840, -43362, -83696, 10688, 166336, 120929, -202864, -387928, 41552, 721344, 518200, -831392, -1567936, 153208, 2780992, 1972020, -3067952, -5710154, 524656, 9756720, 6831888, -10404845, -19126232, 1693320, 31719984, 21959178, -32893728, -59802336, 5154736, 96738057, 66286688, -98010020]]
[-7, [1, 7, 21, 28, -7, -77, -63, 141, 315, -28, -791, -721, 1071, 2569, 119, -5145, -4788, 5922, 14329, 980, -25956, -23619, 27433, 65086, 5054, -109739, -97986, 108864, 254002, 20153, -408044, -357665, 387436, 889077, 71337, -1374246, -1186647, 1259531, 2850750, 227493, -4276111, -3643794, 3811186, 8521205, 676788, -12464011, -10503535, 10850504, 24008957, 1892218, -34387689]]
[-6, [1, 6, 15, 14, -15, -48, -8, 114, 132, -140, -432, -102, 808, 930, -771, -2446, -621, 4002, 4448, -3522, -10767, -2628, 16446, 17754, -13463, -40332, -9744, 58338, 61647, -45768, -134315, -31782, 187119, 194342, -141390, -408918, -95570, 552048, 565320, -405948, -1158321, -267150, 1525548, 1544100, -1095213, -3092344, -706296, 3987330, 3996003, -2807736, -7852974]]
[-5, [1, 5, 10, 5, -15, -24, 15, 70, 30, -125, -175, 95, 420, 180, -615, -826, 410, 1760, 705, -2415, -3100, 1530, 6270, 2460, -8090, -10174, 4840, 19570, 7500, -24360, -30024, 14130, 55970, 21155, -67380, -81926, 37895, 148410, 55305, -174500, -209577, 96025, 371620, 137160, -427665, -508800, 230670, 885070, 323605, -1001340, -1181123]]
[-4, [1, 4, 6, 0, -11, -8, 18, 32, -10, -72, -42, 96, 153, -40, -288, -160, 344, 524, -146, -944, -501, 1080, 1602, -416, -2727, -1436, 2970, 4336, -1131, -7176, -3694, 7616, 10942, -2776, -17562, -8960, 18136, 25784, -6528, -40608, -20472, 41176, 57974, -14464, -89538, -44808, 89202, 124608, -30961, -189736, -94188]]
[-3, [1, 3, 3, -2, -6, 0, 12, 9, -15, -28, 3, 48, 33, -48, -87, 7, 135, 90, -134, -234, 21, 356, 237, -330, -575, 42, 831, 540, -762, -1296, 107, 1848, 1191, -1633, -2769, 210, 3842, 2448, -3366, -5634, 444, 7722, 4889, -6624, -11028, 840, 14871, 9342, -12636, -20877, 1608]]
[-2, [1, 2, 1, -2, -2, 2, 5, 0, -8, -6, 7, 14, 1, -18, -15, 14, 30, 2, -40, -32, 32, 66, 6, -82, -65, 60, 125, 8, -157, -120, 117, 238, 19, -286, -222, 206, 419, 28, -507, -386, 366, 732, 55, -864, -659, 610, 1224, 86, -1442, -1090, 1016]]
[-1, [1, 1, 0, -1, 0, 1, 1, -1, -2, 0, 2, 2, -1, -3, -1, 3, 3, -2, -5, -1, 6, 5, -3, -8, -2, 8, 7, -5, -12, -2, 13, 12, -7, -18, -4, 18, 16, -11, -26, -5, 27, 24, -14, -37, -8, 37, 33, -21, -52, -10, 53]]
[0, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
[1, [1, -1, 1, 0, -1, 1, -1, 1, 0, -1, 2, -3, 2, 0, -2, 4, -4, 3, -1, -3, 6, -7, 5, 0, -5, 9, -10, 7, -1, -7, 14, -16, 11, -1, -11, 20, -22, 16, -2, -15, 29, -33, 23, -2, -23, 41, -45, 32, -4, -30, 57]]
[2, [1, -2, 3, -2, -1, 4, -6, 6, -3, -2, 9, -16, 17, -10, -5, 24, -36, 36, -21, -10, 46, -74, 77, -42, -22, 94, -144, 142, -78, -38, 172, -266, 266, -146, -73, 312, -471, 464, -251, -122, 534, -814, 801, -432, -213, 910, -1364, 1328, -713, -344, 1485]]
[3, [1, -3, 6, -7, 3, 6, -17, 24, -21, 6, 21, -54, 77, -72, 24, 64, -159, 216, -190, 57, 159, -392, 534, -468, 144, 381, -924, 1220, -1044, 312, 833, -1992, 2625, -2244, 669, 1746, -4138, 5382, -4530, 1332, 3474, -8184, 10591, -8886, 2607, 6724, -15711, 20160, -16771, 4872, 12537]]
[4, [1, -4, 10, -16, 15, 0, -30, 64, -81, 60, 12, -128, 250, -312, 234, 32, -443, 848, -1014, 720, 109, -1312, 2448, -2880, 2033, 280, -3550, 6512, -7513, 5184, 744, -8832, 15980, -18252, 12492, 1712, -20745, 37168, -41942, 28352, 3918, -46288, 82146, -92000, 61785, 8384, -99174, 174720, -194134, 129288, 17546]]
[5, [1, -5, 15, -30, 40, -26, -30, 125, -220, 245, -124, -180, 615, -1010, 1085, -550, -705, 2415, -3850, 3980, -1926, -2460, 8090, -12550, 12715, -6074, -7500, 24360, -37150, 36930, -17251, -21155, 67380, -101210, 99295, -45924, -55305, 174500, -259140, 251275, -114750, -137160, 427665, -628760, 604095, -273626, -323605, 1001340, -1460180, 1391295, -624848]]
[6, [1, -6, 21, -50, 84, -90, 15, 180, -465, 700, -648, 72, 1097, -2580, 3648, -3242, 423, 4902, -11256, 15408, -13227, 1650, 18738, -41724, 55617, -46668, 5838, 63070, -137982, 180540, -148656, 18150, 194097, -417430, 537648, -436392, 52910, 553836, -1176561, 1496930, -1200285, 143478, 1488820, -3127542, 3937044, -3125154, 370716, 3801276, -7913772, 9873882, -7769451]]
[7, [1, -7, 28, -77, 154, -217, 161, 153, -791, 1589, -2044, 1393, 1029, -5194, 9766, -11886, 7854, 5005, -25599, 46718, -55055, 35343, 21175, -106484, 189049, -217056, 136318, 78498, -389761, 678720, -764477, 471541, 265097, -1296771, 2220792, -2461759, 1496320, 825643, -3991211, 6745704, -7381913, 4431749, 2411821, -11530029, 19265841, -20850886, 12386906, 6663874, -31560228, 52229899, -55998628]]
[8, [1, -8, 36, -112, 258, -440, 496, -112, -1049, 3008, -5024, 5360, -1686, -7608, 21376, -33856, 34543, -11472, -41404, 114544, -175940, 174296, -58176, -189648, 514298, -769664, 744088, -246336, -760302, 2026752, -2973920, 2821440, -924075, -2754880, 7231920, -10437504, 9746754, -3156520, -9190608, 23812704, -33904299, 31248712, -10015232, -28651536, 73391344, -103282720, 94125760, -29878640, -84321679, 213851288, -297958584]]
[9, [1, -9, 45, -156, 405, -801, 1149, -891, -855, 4790, -10377, 14643, -11859, -4617, 37629, -79635, 107685, -85473, -22238, 222066, -459927, 604212, -470070, -97497, 1091517, -2213721, 2838285, -2165007, -395307, 4681476, -9324735, 11726838, -8797455, -1482462, 18079857, -35454276, 43868498, -32431977, -5193486, 64142478, -124102764, 151475247, -110588673, -17095158, 212139153, -405679769, 489372516, -353362500, -53284155, 661073463, -1251327069]]
[10, [1, -10, 55, -210, 605, -1352, 2300, -2630, 570, 6160, -18522, 32990, -38590, 17410, 47685, -156802, 272890, -310500, 152005, 293580, -992876, 1689240, -1877000, 935940, 1528385, -5203696, 8670710, -9431000, 4695055, 6993230, -23725756, 38827080, -41481615, 20507870, 28831575, -97132194, 156500450, -164639160, 80660650, 109125120, -364517778, 579443490, -601542940, 291999320, 384334330, -1272738402, 1999485490, -2051852270, 987093095, 1272932000, -4179922966]]
[11, [1, -11, 66, -275, 869, -2156, 4191, -6006, 4620, 5181, -28567, 64481, -96602, 87120, 16467, -251394, 585981, -862455, 781869, 9570, -1694869, 3957690, -5706403, 5118102, -279202, -9495167, 22012485, -31127305, 27513706, -2334640, -46296943, 106191976, -147598473, 128617808, -12933437, -202295874, 458844166, -628202520, 540216358, -58910874, -808452601, 1813784654, -2450591627, 2082298097, -237047955, -2998544692, 6658914075, -8892531846, 7475107233, -870993739, -10436689692]]
[12, [1, -12, 78, -352, 1209, -3288, 7138, -12000, 13596, -2080, -36606, 111360, -206181, 256200, -139284, -285984, 1071087, -2009256, 2489364, -1528464, -1838544, 7740064, -14427624, 17621568, -11162727, -10219044, 46056996, -84876912, 102019968, -64998576, -50685750, 237269856, -431725065, 511081936, -324642030, -228454608, 1091778688, -1962068232, 2290731408, -1445700960, -949337475, 4583473284, -8141849946, 9387812304, -5879310774, -3676838200, 17824500348, -31325988576, 35717952769, -22191221580, -13392004356]]

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。