xx + 27yy 型の素数
tsujimotter さんの本日のブログ
(http://tsujimotter.hatenablog.com/entry/xx-27yy)
について、自分で実験してみることにした。
require 'prime'
# m次以下を取り出す
def mul(f_ary, b_ary, m)
s1, s2 = f_ary.size, b_ary.size
ary = Array.new(s1 + s2 - 1, 0)
(0..s1 - 1).each{|i|
(0..s2 - 1).each{|j|
ary[i + j] += f_ary[i] * b_ary[j]
}
}
ary[0..m]
end
# 1 - q^(6n)
def f1(n)
f1 = Array.new(6 * n + 1, 0)
f1[0] = 1
f1[-1] = -1
f1
end
# 1 - q^(18n)
def f2(n)
f2 = Array.new(18 * n + 1, 0)
f2[0] = 1
f2[-1] = -1
f2
end
ary = [0, 1]
n = 1
while 6 * n <= 300
ary = mul(ary, f1(n), 300)
n += 1
end
n = 1
while 18 * n <= 300
ary = mul(ary, f2(n), 300)
n += 1
end
p ary
Prime.each(300){|i| p [i, ary[i]]}
出力結果
[0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[2, 0]
[3, 0]
[5, 0]
[7, -1]
[11, 0]
[13, -1]
[17, 0]
[19, -1]
[23, 0]
[29, 0]
[31, 2]
[37, -1]
[41, 0]
[43, 2]
[47, 0]
[53, 0]
[59, 0]
[61, -1]
[67, -1]
[71, 0]
[73, -1]
[79, -1]
[83, 0]
[89, 0]
[97, -1]
[101, 0]
[103, -1]
[107, 0]
[109, 2]
[113, 0]
[127, 2]
[131, 0]
[137, 0]
[139, -1]
[149, 0]
[151, -1]
[157, 2]
[163, -1]
[167, 0]
[173, 0]
[179, 0]
[181, -1]
[191, 0]
[193, -1]
[197, 0]
[199, -1]
[211, -1]
[223, 2]
[227, 0]
[229, 2]
[233, 0]
[239, 0]
[241, -1]
[251, 0]
[257, 0]
[263, 0]
[269, 0]
[271, -1]
[277, 2]
[281, 0]
[283, 2]
[293, 0]
赤字の素数がxx + 27yy 型の素数となる。
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。