A013918
一瞬で次まで求まる。
出力結果
[2, 5, 17, 41, 197, 281, 7699, 8893, 22039, 24133, 25237, 28697, 32353, 37561, 38921, 43201, 44683, 55837, 61027, 66463, 70241, 86453, 102001, 109147, 116533, 119069, 121631, 129419, 132059, 263171, 287137, 325019, 329401, 333821, 338279, 342761, 360979, 379667, 393961, 398771, 581921, 642869, 681257, 687767, 700897, 754573, 768373, 782263, 868151, 935507, 958577, 1005551, 1086557, 1313041, 1359329, 1583293, 1603597, 1686239, 1749833, 1891889, 2051167, 2086159, 2133121, 2156813, 2180741, 2327399, 2364833, 2402537, 2504323, 2556187, 2582401, 2608699, 3120833, 3238237, 3557303, 3619807, 3875933, 3892271, 3925069, 3974497, 4260917, 4504663, 4682791, 4846279, 4901431, 4956893, 4975457, 5238847, 5353841, 5373133, 5411839, 5666783]
require 'prime'
s = 0
ary = []
Prime.each(10 ** 4){|i|
s += i
ary << s if s.prime?
}
p ary
出力結果
[2, 5, 17, 41, 197, 281, 7699, 8893, 22039, 24133, 25237, 28697, 32353, 37561, 38921, 43201, 44683, 55837, 61027, 66463, 70241, 86453, 102001, 109147, 116533, 119069, 121631, 129419, 132059, 263171, 287137, 325019, 329401, 333821, 338279, 342761, 360979, 379667, 393961, 398771, 581921, 642869, 681257, 687767, 700897, 754573, 768373, 782263, 868151, 935507, 958577, 1005551, 1086557, 1313041, 1359329, 1583293, 1603597, 1686239, 1749833, 1891889, 2051167, 2086159, 2133121, 2156813, 2180741, 2327399, 2364833, 2402537, 2504323, 2556187, 2582401, 2608699, 3120833, 3238237, 3557303, 3619807, 3875933, 3892271, 3925069, 3974497, 4260917, 4504663, 4682791, 4846279, 4901431, 4956893, 4975457, 5238847, 5353841, 5373133, 5411839, 5666783]
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。