双子素数はレア物か?
このワークシートはMath by Codeの一部です。
<双子素数>
1ちがいの素数は2,3のペアしかありません。
2ちがいの素数は3,5や5,7のように、最初はたくさんあります。
他にも調べてみましょう。
桁数が爆発しないのでJuliaをそのまま使います。
[IN]julia
#=====================================================
function isPrime(n)
lim = Int(round(n^0.5))
if n<2
return false
end
for num in 2:lim
if n % num ==0
return false
end
end
return true
end
N= [x for x in 2:100]
TTop = filter(n->(isPrime(n)==true && isPrime(n+2)==true),N)
Twin = map(n->(n,n+2), TTop)
println(Twin," 個数=",length(Twin))
println(Twin)
#=====================================================
[OUT]
[(3, 5), (5, 7), (11, 13), (17, 19), (29, 31), (41, 43), (59, 61), (71, 73)]
100以下に8組見つかった。
整数を100個刻みで区切って、
双子素数の分布のようすをざっと調べてみよう。
[IN]julia
#=====================================================
for cluster in 0:30
N= [x for x in 0+cluster*100:99+cluster*100]
TTop = filter(n->(isPrime(n)==true && isPrime(n+2)==true),N)
Twin = map(n->(n,n+2), TTop)
println(Twin," 個数=",length(Twin))
end
#=====================================================
[OUT]
[(3, 5), (5, 7), (11, 13), (17, 19), (29, 31), (41, 43), (59, 61), (71, 73)] 個数=8
[(101, 103), (107, 109), (137, 139), (149, 151), (179, 181), (191, 193), (197, 199)] 個数=7
[(227, 229), (239, 241), (269, 271), (281, 283)] 個数=4
[(311, 313), (347, 349)] 個数=2
[(419, 421), (431, 433), (461, 463)] 個数=3
[(521, 523), (569, 571), (599, 601)] 個数=3
[(617, 619), (641, 643), (659, 661)] 個数=3
Tuple{Int64, Int64}[] 個数=0
[(809, 811), (821, 823), (827, 829), (857, 859), (881, 883)] 個数=5
Tuple{Int64, Int64}[] 個数=0
[(1019, 1021), (1031, 1033), (1049, 1051), (1061, 1063), (1091, 1093)] 個数=5
[(1151, 1153)] 個数=1
[(1229, 1231), (1277, 1279), (1289, 1291)] 個数=3
[(1301, 1303), (1319, 1321)] 個数=2
[(1427, 1429), (1451, 1453), (1481, 1483), (1487, 1489)] 個数=4
Tuple{Int64, Int64}[] 個数=0
[(1607, 1609), (1619, 1621), (1667, 1669), (1697, 1699)] 個数=4
[(1721, 1723), (1787, 1789)] 個数=2
[(1871, 1873), (1877, 1879)] 個数=2
[(1931, 1933), (1949, 1951), (1997, 1999)] 個数=3
[(2027, 2029), (2081, 2083), (2087, 2089)] 個数=3
[(2111, 2113), (2129, 2131), (2141, 2143)] 個数=3
[(2237, 2239), (2267, 2269)] 個数=2
[(2309, 2311), (2339, 2341), (2381, 2383)] 個数=3
Tuple{Int64, Int64}[] 個数=0
[(2549, 2551), (2591, 2593)] 個数=2
[(2657, 2659), (2687, 2689)] 個数=2
[(2711, 2713), (2729, 2731), (2789, 2791)] 個数=3
[(2801, 2803)] 個数=1
[(2969, 2971), (2999, 3001)] 個数=2
Tuple{Int64, Int64}[] 個数=0
数が増えるとレアになるというほどの分布の規則性はなさそうですね。
質問:双子素数の分布を、1000刻みにして個数だけしらべるとどうなるでしょうか?
[IN]julia
#===================================================
println("1000刻みの双子素数の組数")
for cluster in 0:1000
starting=0+cluster*1000
ending=1000-1+cluster*1000
N= [x for x in starting:ending]
TTop = filter(n->(isPrime(n)==true && isPrime(n+2)==true),N)
Twin = map(n->(n,n+2), TTop)
print(length(Twin),",")
end
#===================================================
[OUT]
1000刻みの双子素数の組数
35,26,21,21,23,17,19,13,15,15,16,14,11,15,11,12,13,18,12,15,15,15,16,14,6,12,11,15,12,9,11,13,19,13,16,11,9,12,11,9,8,12,12,11,11,7,12,11,13,17,9,14,8,11,8,11,14,9,11,11,10,6,8,10,9,14,6,10,9,12,16,10,11,6,10,9,11,9,9,11,13,12,13,8,12,11,8,14,10,8,10,10,12,12,13,8,7,15,13,8,6,10,12,10,11,5,14,5,12,11,8,9,9,14,7,14,7,15,7,14,6,11,15,5,12,7,5,9,13,10,8,11,9,8,9,13,12,5,8,8,10,9,9,7,7,9,9,6,11,16,10,12,13,8,11,9,9,12,5,11,11,10,6,10,8,7,8,9,4,8,5,10,5,9,10,9,16,7,14,10,7,14,13,11,10,9,10,9,3,12,5,13,10,7,5,8,8,11,9,9,4,9,7,14,10,7,9,11,13,9,7,12,3,5,7,5,8,12,8,9,7,11,9,13,3,14,6,9,11,10,8,10,8,10,10,8,8,6,8,5,6,11,5,7,8,13,9,12,7,7,6,13,2,8,7,8,9,9,5,8,8,6,9,10,8,9,12,15,8,5,9,7,12,7,5,10,8,9,11,4,7,10,9,9,13,10,6,6,8,8,9,8,5,5,7,8,11,3,9,8,11,10,6,8,9,8,9,10,8,10,6,7,15,8,6,7,8,12,11,7,12,8,12,10,9,11,11,12,11,7,12,8,7,7,8,3,8,9,6,4,8,5,10,9,7,6,9,11,6,6,5,9,10,5,9,10,7,10,10,5,9,10,5,10,5,9,7,7,4,6,4,9,7,6,7,11,8,4,4,9,10,9,6,9,4,9,11,4,8,8,10,8,11,7,8,5,7,11,7,9,5,6,12,7,10,14,6,6,5,6,11,7,7,7,9,7,8,9,6,9,10,7,9,7,9,9,8,13,7,14,10,7,8,6,7,10,7,4,4,2,11,7,9,11,8,5,6,6,5,7,10,8,5,7,13,6,8,7,6,7,5,7,5,9,12,8,2,9,5,3,9,9,8,9,6,12,6,7,10,5,7,5,8,4,5,3,11,8,9,10,11,9,7,8,6,11,4,5,9,8,8,5,6,8,7,10,7,8,5,3,10,6,8,7,7,5,9,8,13,7,9,10,11,6,15,7,10,5,8,10,5,4,7,6,5,6,15,1,13,11,12,5,6,9,7,5,5,6,4,12,12,4,9,7,7,5,6,8,6,7,10,3,8,8,8,10,6,7,3,10,13,6,10,9,7,8,7,10,7,10,8,11,10,5,4,7,10,8,6,9,6,6,6,9,12,11,6,8,6,5,11,4,7,10,4,7,7,12,11,6,7,6,6,7,8,7,7,8,7,6,5,6,11,9,7,6,7,8,7,10,4,12,9,6,7,8,8,12,3,7,7,8,9,4,10,7,8,8,7,10,4,10,9,9,7,5,3,8,8,5,12,6,8,13,8,7,8,10,5,7,6,4,7,9,6,8,6,9,8,7,10,9,3,7,6,5,10,6,1,5,7,8,6,8,10,5,8,8,4,4,7,11,8,5,8,6,6,6,9,9,10,5,8,8,4,8,7,4,4,7,8,6,2,11,6,8,8,8,10,7,4,7,4,9,4,6,8,11,5,9,7,8,7,9,4,7,9,7,8,6,5,4,7,8,9,7,2,5,10,6,3,10,6,3,9,6,6,7,7,8,9,8,8,14,4,4,5,9,8,7,6,11,7,12,6,6,7,5,5,7,7,8,8,6,10,10,8,7,3,9,9,6,4,6,4,5,6,6,8,8,6,3,7,2,11,4,7,7,7,12,8,6,15,12,7,8,9,5,6,6,7,10,6,5,9,7,8,5,11,6,7,5,10,8,7,5,7,5,5,6,4,1,9,6,7,6,7,11,3,9,9,6,10,4,11,7,6,5,10,6,6,2,12,10,5,11,11,6,5,8,11,6,8,7,7,6,11,10,9,6,4,12,2,4,8,11,4,8,6,4,8,8,3,2,8,3,6,12,8,11,7,9,9,3,8,7,9,7,5,11,8,9,10,7,10,5,6,1,11,8,8,4,8,4,7,6,4,9,4,10,5,6,7,7,9,10,9,3,5,10,6,8,6,3,8,10,2,7,9,5,8,13,8,9,6,6,6,5,6,6,8,7,10,8,11,5,5,6,8,3,9,7,7,9,5,5,9,3,7,7,6,5,5,4,10,8,8,12,5,4,11,
どうも、単調に減少しないですね。
自然数が大きくなると素数がまばらになるとしたら、双子素数の組もまばらになりそうですが、
そうでもなさそうです。超ゆっくり減っているのでしょうか?
質問:双子素数の分布がNの大きさと負の相関がありそうな刻み幅はどのくらいでしょうか。
(参考)
[IN]
#===================================================
size=10000
println(size,"刻みの双子素数の組数")
for cluster in 0:size/10
starting=0+cluster*size
ending=size-1+cluster*size
N= [x for x in starting:ending]
TTop = filter(n->(isPrime(n)==true && isPrime(n+2)==true),N)
Twin = map(n->(n,n+2), TTop)
print(length(Twin),",")
end
#===================================================
[OUT]
10000刻みの双子素数の組数
205,137,125,124,114,106,94,102,109,108,96,104,93,91,93,100,81,95,98,85,93,76,93,81,85,75,90,82,86,73,89,87,103,72,77,80,72,69,78,83,77,80,93,65,75,77,65,81,70,78,67,80,91,73,71,71,73,87,78,75,79,69,76,76,78,68,84,70,62,68,75,65,74,67,72,63,65,76,72,76,62,66,82,74,65,63,74,76,81,63,69,75,75,64,71,64,73,71,68,67,84,69,73,69,79,62,69,71,65,84,70,67,70,76,65,70,70,68,77,72,49,66,69,68,80,58,74,61,67,60,68,72,63,67,80,74,72,71,66,68,72,53,65,57,59,63,78,67,62,68,71,75,68,60,66,67,67,67,69,54,72,66,74,67,61,61,68,72,58,72,70,64,69,66,71,53,64,59,59,77,67,67,68,74,57,64,69,65,69,57,59,63,78,57,65,58,59,61,64,67,67,65,75,63,55,67,66,64,69,53,51,67,56,64,64,65,66,57,55,57,59,58,67,65,76,61,65,66,58,63,52,55,64,59,70,62,70,54,64,55,55,65,57,48,55,71,55,61,63,47,55,56,62,61,60,52,63,63,75,61,59,65,57,54,67,69,67,54,58,59,65,65,54,62,61,57,61,59,56,63,69,54,54,61,63,50,57,57,56,56,49,57,64,52,57,62,61,68,70,58,64,53,52,51,62,60,61,70,75,64,60,54,61,59,60,52,61,50,67,69,65,68,68,56,52,51,64,59,57,60,62,56,62,55,55,53,64,63,51,69,70,58,62,62,55,57,57,50,54,59,55,60,59,60,58,61,60,56,53,64,65,67,67,67,51,61,58,64,54,71,58,63,62,51,61,61,50,65,48,57,56,53,68,63,66,53,55,64,58,57,55,62,62,59,71,56,46,48,56,54,56,60,66,67,68,63,44,62,54,56,63,48,51,61,56,62,61,55,61,57,54,61,56,57,57,59,55,49,51,61,53,50,54,56,49,52,58,56,54,59,62,61,64,54,63,50,54,62,58,45,55,61,60,44,59,42,54,61,61,55,53,50,55,53,65,50,56,67,59,52,58,58,52,54,48,62,54,53,52,48,48,52,56,61,54,62,59,42,51,63,63,59,62,49,52,47,59,62,59,47,56,49,52,40,50,55,56,56,52,47,54,41,59,61,57,61,56,59,55,46,65,47,46,54,62,57,54,50,52,48,60,58,56,54,50,56,56,47,52,63,56,55,52,54,64,67,62,45,57,54,55,62,58,59,52,50,58,57,53,61,55,55,54,48,60,51,47,49,51,50,55,59,60,46,52,55,60,55,60,60,48,54,43,59,70,54,44,51,56,63,45,53,79,56,47,52,47,50,60,60,64,62,54,45,56,57,45,55,60,47,69,67,48,68,50,53,54,51,57,53,62,53,51,57,51,57,59,51,52,54,50,51,50,56,49,57,51,54,41,55,52,53,48,46,49,56,56,54,51,63,53,62,65,45,46,46,59,44,57,49,52,62,53,42,53,48,47,56,50,54,52,52,53,45,63,69,45,37,48,47,55,50,57,44,58,50,60,53,60,48,53,55,59,59,55,52,65,51,49,52,50,53,52,57,63,46,41,54,51,57,55,52,51,45,51,63,54,52,52,56,56,49,54,54,50,53,52,54,51,59,51,52,53,54,54,50,52,52,49,55,49,59,46,61,59,53,60,58,42,57,56,51,49,57,58,63,55,52,52,57,66,45,54,52,53,49,47,58,61,49,49,61,51,54,65,57,53,50,56,56,57,59,55,57,51,52,47,47,64,49,51,48,52,55,49,55,58,56,59,49,67,45,47,43,58,54,54,61,45,43,49,45,52,40,50,56,56,61,60,48,55,49,56,57,56,52,52,49,63,54,39,58,47,39,58,49,51,46,65,51,58,63,45,45,53,54,48,51,57,54,55,58,52,52,60,55,53,59,51,52,60,62,48,55,57,54,59,47,56,44,44,59,46,51,43,49,54,55,61,57,45,42,55,52,43,54,52,55,48,49,54,65,51,64,50,46,53,47,52,56,35,47,52,52,53,51,44,48,74,47,51,45,47,60,56,48,54,47,52,48,46,47,52,47,49,49,58,52,54,62,44,58,52,54,55,54,53,45,50,55,52,50,43,48,61,49,56,54,43,47,46,44,40,53,65,67,46,45,62,47,43,60,52,52,60,52,56,51,55,43,55,48,66,50,57,56,40,68,50,70,42,54,52,44,51,37,44,56,47,43,49,57,44,50,46,53,45,51,51,48,55,
最初だけ急減にへり、あとはとてもなだらかにへり続けますね。