Expansion of Product_{j=1..k} theta_3(q^j)
つい最近質問を受けたので、k<=16 のとき出力してみた。
コードは181013分とあまり変わらない。
def s(k, n)
s = 0
(1..n).each{|i| s += i if n % i == 0 && i % k == 0}
s
end
def A(ary, n)
a_ary = [1]
a = [0] + (1..n).map{|i| ary.inject(0){|s, j| s + j[1] * s(j[0], i)}}
(1..n).each{|i| a_ary << (1..i).inject(0){|s, j| s - a[j] * a_ary[-j]} / i}
a_ary
end
def B(k, n)
ary = []
(1..k).each{|i|
ary << [2 * i, 5]
ary << [i, -2]
ary << [4 * i, -2]
}
A(ary, n)
end
n = 16
(0..n).each{|i| p [i, B(i, 20)]}
出力結果
[0, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
[1, [1, 2, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0]]
[2, [1, 2, 2, 4, 2, 0, 4, 0, 2, 6, 0, 4, 4, 0, 0, 0, 2, 4, 6, 4, 0]]
[3, [1, 2, 2, 6, 6, 4, 12, 4, 2, 14, 0, 8, 18, 4, 12, 16, 6, 4, 14, 8, 12]]
[4, [1, 2, 2, 6, 8, 8, 16, 16, 14, 22, 24, 16, 22, 32, 12, 32, 44, 16, 42, 52, 36]]
[5, [1, 2, 2, 6, 8, 10, 20, 20, 26, 38, 40, 48, 54, 60, 56, 80, 76, 60, 106, 76, 102]]
[6, [1, 2, 2, 6, 8, 10, 22, 24, 30, 50, 56, 68, 94, 100, 108, 156, 156, 156, 214, 196, 214]]
[7, [1, 2, 2, 6, 8, 10, 22, 26, 34, 54, 68, 84, 114, 144, 156, 216, 256, 268, 350, 384, 414]]
[8, [1, 2, 2, 6, 8, 10, 22, 26, 36, 58, 72, 96, 130, 164, 200, 268, 324, 376, 486, 552, 642]]
[9, [1, 2, 2, 6, 8, 10, 22, 26, 36, 60, 76, 100, 142, 180, 220, 312, 376, 448, 602, 696, 834]]
[10, [1, 2, 2, 6, 8, 10, 22, 26, 36, 60, 78, 104, 146, 192, 236, 332, 420, 500, 674, 816, 986]]
[11, [1, 2, 2, 6, 8, 10, 22, 26, 36, 60, 78, 106, 150, 196, 248, 348, 440, 544, 726, 888, 1106]]
[12, [1, 2, 2, 6, 8, 10, 22, 26, 36, 60, 78, 106, 152, 200, 252, 360, 456, 564, 770, 940, 1178]]
[13, [1, 2, 2, 6, 8, 10, 22, 26, 36, 60, 78, 106, 152, 202, 256, 364, 468, 580, 790, 984, 1230]]
[14, [1, 2, 2, 6, 8, 10, 22, 26, 36, 60, 78, 106, 152, 202, 258, 368, 472, 592, 806, 1004, 1274]]
[15, [1, 2, 2, 6, 8, 10, 22, 26, 36, 60, 78, 106, 152, 202, 258, 370, 476, 596, 818, 1020, 1294]]
[16, [1, 2, 2, 6, 8, 10, 22, 26, 36, 60, 78, 106, 152, 202, 258, 370, 478, 600, 822, 1032, 1310]]
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。