A213261
p(7*n+5) を出力してみた。
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
n = 15
a = [7, 49]
ary = (0..1).map{|i| p [0] * i + A([[7, 4 * (i + 1) - 1], [1, -4 * (i + 1)]], n)}
(0..n).each{|i|
print "#{(0..1).inject(0){|s, j| s + a[j] * ary[j][i]}} = "
(0..1).each{|j|
print " + " if j > 0
print "#{a[j]} * #{ary[j][i]}"
}
puts
}
出力結果
[1, 4, 14, 40, 105, 252, 574, 1237, 2568, 5138, 9988, 18893, 34937, 63238, 112370, 196244]
[0, 1, 8, 44, 192, 726, 2464, 7704, 22521, 62281, 164252, 415796, 1015334, 2401462, 5519640, 12363062, 27047913]
7 = 7 * 1 + 49 * 0
77 = 7 * 4 + 49 * 1
490 = 7 * 14 + 49 * 8
2436 = 7 * 40 + 49 * 44
10143 = 7 * 105 + 49 * 192
37338 = 7 * 252 + 49 * 726
124754 = 7 * 574 + 49 * 2464
386155 = 7 * 1237 + 49 * 7704
1121505 = 7 * 2568 + 49 * 22521
3087735 = 7 * 5138 + 49 * 62281
8118264 = 7 * 9988 + 49 * 164252
20506255 = 7 * 18893 + 49 * 415796
49995925 = 7 * 34937 + 49 * 1015334
118114304 = 7 * 63238 + 49 * 2401462
271248950 = 7 * 112370 + 49 * 5519640
607163746 = 7 * 196244 + 49 * 12363062
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。