Jump to content

Check if sum of first n primes is prime: Difference between revisions

m
Line 14:
So, with a bit of experimentation, we find that to duplicate the Ring result we need to sum up to the first 160 primes, which then
gives us 20 prime results when we filter for a prime number as the sum:
<lang julia>julia> julia> filter(p -> isprime(p[2]), collect(enumerate(accumulate(+, primes(prime(160))))))
20-element Vector{Tuple{Int64, Int64}}:
(1, 2)
(2, 5)
(4, 17)
(6, 41)
(12, 197)
(14, 281)
(60, 7699)
(64, 8893)
(96, 22039)
(100, 24133)
(102, 25237)
(108, 28697)
(114, 32353)
(122, 37561)
(124, 38921)
(130, 43201)
(132, 44683)
(146, 55837)
(152, 61027)
(158, 66463)
</lang>
 
 
=={{header|Ring}}==
4,105

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.