2017年4月30日日曜日

170430

Ruby


Glaisher's chi_4(n)(5)

一般に
1/4 * Sum_{a^2 + b^2 = n} (a + bi)^(4 * k)
の場合を計算してみた。

def G(a, n)
  ary = []
  (1..n).each{|j|
    s = 0
    (1..Math.sqrt(j).to_i).each{|k|
      m = Math.sqrt(j - k * k).to_i
      if m * m == j - k * k
        x = (k + m * 1i) ** a
        s += x
      end
    }
    ary << s.real
  }
  ary
end

n = 50
0.step(48, 4){|i| p [i, G(i, n)]}

出力結果
[0, [1, 1, 0, 1, 2, 0, 0, 1, 1, 2, 0, 0, 2, 0, 0, 1, 2, 1, 0, 2, 0, 0, 0, 0, 3, 2, 0, 0, 2, 0, 0, 1, 0, 2, 0, 1, 2, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 1, 3]]
[4, [1, -4, 0, 16, -14, 0, 0, -64, 81, 56, 0, 0, -238, 0, 0, 256, 322, -324, 0, -224, 0, 0, 0, 0, -429, 952, 0, 0, 82, 0, 0, -1024, 0, -1288, 0, 1296, 2162, 0, 0, 896, -3038, 0, 0, 0, -1134, 0, 0, 0, 2401, 1716]]
[8, [1, 16, 0, 256, -1054, 0, 0, 4096, 6561, -16864, 0, 0, -478, 0, 0, 65536, -63358, 104976, 0, -269824, 0, 0, 0, 0, 720291, -7648, 0, 0, -1407838, 0, 0, 1048576, 0, -1013728, 0, 1679616, 925922, 0, 0, -4317184, 3577922, 0, 0, 0, -6915294, 0, 0, 0, 5764801, 11524656]]
[12, [1, -64, 0, 4096, 23506, 0, 0, -262144, 531441, -1504384, 0, 0, 6911282, 0, 0, 16777216, -47295038, -34012224, 0, 96280576, 0, 0, 0, 0, 308391411, -442322048, 0, 0, -173439758, 0, 0, -1073741824, 0, 3026882432, 0, 2176782336, -2050092718, 0, 0, -6161956864, -2285065118, 0, 0, 0, 12492052146, 0, 0, 0, 13841287201, -19737050304]]
[16, [1, 256, 0, 65536, 329666, 0, 0, 16777216, 43046721, 84394496, 0, 0, -1631232958, 0, 0, 4294967296, -9937278718, 11019960576, 0, 21604990976, 0, 0, 0, 0, -43908219069, -417595637248, 0, 0, 981515008322, 0, 0, 1099511627776, 0, -2543943351808, 0, 2821109907456, -6167627357758, 0, 0, 5530877689856, -3168324620158, 0, 0, 0, 14191040325186, 0, 0, 0, 33232930569601, -11240504081664]]
[20, [1, -1024, 0, 1048576, -19306574, 0, 0, -1073741824, 3486784401, 19769931776, 0, 0, 190840318802, 0, 0, 1099511627776, 750325121602, -3570467226624, 0, -20244410138624, 0, 0, 0, 0, 277376367976851, -195420486453248, 0, 0, 203154876160402, 0, 0, -1125899906842624, 0, -768332924520448, 0, 3656158440062976, -9492206529013198, 0, 0, 20730275981950976, 16082418088944802, 0, 0, 0, -67317861059952174, 0, 0, 0, 79792266297612001, -284033400808295424]]
[24, [1, 4096, 0, 16777216, 64250786, 0, 0, 68719476736, 282429536481, 263171219456, 0, 0, 1169648638562, 0, 0, 281474976710656, 1071576144961922, 1156831381426176, 0, 1077949314891776, 0, 0, 0, 0, -55476481273772829, 4790880823549952, 0, 0, -677548216755839518, 0, 0, 1152921504606846976, 0, 4389175889764032512, 0, 4738381338321616896, -8963023859283443038, 0, 0, 4415280393796714496, -39905458007232018238, 0, 0, 0, 18146319708519924066, 0, 0, 0, 191581231380566414401, -227231667297373507584]]
[28, [1, -16384, 0, 268435456, 11167097746, 0, 0, -4398046511104, 22876792454961, -182961729470464, 0, 0, -5728966721281678, 0, 0, 72057594037927936, 282379614196418242, -374813367582081024, 0, 2997644975644082176, 0, 0, 0, 0, 87451169084099139891, 93863390761479012352, 0, 0, -199246537739584127438, 0, 0, -1180591620717411303424, 0, -4626507598994116476928, 0, 6140942214464815497216, -1588134303148899671278, 0, 0, -49113415280952642371584, 75787711604536118762722, 0, 0, 0, 255467377459504789617906, 0, 0, 0, 459986536544739960976801, -1432799954273880307974144]]
[32, [1, 65536, 0, 4294967296, -196496109694, 0, 0, 281474976710656, 1853020188851841, -12877569044905984, 0, 0, 1330087744899070082, 0, 0, 18446744073709551616, 1427124567881986562, 121439531096594251776, 0, -843944364926958567424, 0, 0, 0, 0, 15327656759489517883011, 87168630449705456893952, 0, 0, 462878764200641031680642, 0, 0, 1208925819614629174706176, 0, 93528035680713871327232, 0, 7958661109946400884391936, 13364603395730595798238082, 0, 0, -55308737899853156674699264, -117479780930606773712920318, 0, 0, 0, -364111258293827945049846654, 0, 0, 0, 1104427674243920646305299201, 1004513313389905043981008896]]
[36, [1, -262144, 0, 68719476736, -4228490555534, 0, 0, -18014398509481984, 150094635296999121, 1108473428189904896, 0, 0, -152935864759452674158, 0, 0, 4722366482869645213696, -23125093646441048317118, -39346408075296537575424, 0, -290579658359414429057024, 0, 0, 0, 0, 3328217149873384131384531, 40091219331501961814474752, 0, 0, 178879349123443365836288722, 0, 0, -1237940039285380274899124224, 0, 6062104548852642170042580992, 0, 10314424798490535546171949056, 31870691915293393072612781042, 0, 0, 76173713960970336090724499456, 142745614735837791048783844642, 0, 0, 0, -634673747789680938240399685614, 0, 0, 0, 2651730845859653471779023381601, -872472156536408409737666494464]]
[40, [1, 1048576, 0, 1099511627776, 182008936336226, 0, 0, 1152921504606846976, 12157665459056928801, 190850202427694514176, 0, 0, -1589900269312604162398, 0, 0, 1208925819614629174706176, -7565475025188088957756798, 12748236216396078174437376, 0, 200120941860822202896613376, 0, 0, 0, 0, 24032305888515086764969532451, -1667131264794733222190645248, 0, 0, -312717248594471233529540479198, 0, 0, 1267650600228229401496703205376, 0, -7932975540011625566968792219648, 0, 13367494538843734067838845976576, 43857017456118466671167150613602, 0, 0, 209842016732653502224519267352576, -101691394325222881712409889310398, 0, 0, 0, 2212803758534626401134640679045026, 0, 0, 0, 6366805760909027985741435139224001, 25199699179355595619664692459339776]]
[44, [1, -4194304, 0, 17592186044416, 94681488501586, 0, 0, -73786976294838206464, 984770902183611232881, -397122945948156166144, 0, 0, 4746397497491127617277362, 0, 0, 309485009821345068724781056, -504652011666161847903676478, -4130428534112329328517709824, 0, 1665654360682135200282443776, 0, 0, 0, 0, -5675377301815925525037469625229, -19907834009317026529656908546048, 0, 0, -152160779312124788381478442879118, 0, 0, -1298074214633706907132624082305024, 0, 2116663951139429303309781866381312, 0, 17324272922341479351919144385642496, 35088063909469944088702337296151762, 0, 0, -6986260747626522399085455059451904, -94426535081528617629501241894433438, 0, 0, 0, 93239574851794058485356430783849266, 0, 0, 0, 15286700631942576193765185769276826401, 23804257718515743693366758998976495616]]
[48, [1, 16777216, 0, 281474976710656, -115081126049163454, 0, 0, 4722366482869645213696, 79766443076872509863361, -1930740909250041887064064, 0, 0, -1084233462811051085429762878, 0, 0, 79228162514264337593543950336, 469378091822230262815821699842, 1338258845052394702439737982976, 0, -32392457274524350748321407565824, 0, 0, 0, 0, 9690951893942946361799831871319491, -18190419000008971247289584632987648, 0, 0, 208701784399551975874725687351552962, 0, 0, 1329227995784915872903807060280344576, 0, 7874857632169390720997808875736399872, 0, 22452257707354557240087211123792674816, -6334717520302422495126844926858828478, 0, 0, -543455252465466329764349892155863465984, 574223389697520075808965854102928347522, 0, 0, 0, -9179612090222986848475130127017894808894, 0, 0, 0, 36703368217294125441230211032033660188801, 162587193170289902788329928068811305517056]]

0 件のコメント:

コメントを投稿

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