Check if sum of first n primes is prime

From Rosetta Code
Check if sum of first n primes is prime is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Task
Check if sum of first n primes is prime, where n <= 20



Julia

<lang julia>using Primes </lang> The sum of the first 20 primes is <lang julia>julia> sum(prime(i) for i in 1:20) 639 </lang> So, with a bit of experimentation, we find that to duplicate the Ring result we need to sum up to the first 158 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(158)))))) 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>

Ring

<lang ring> load "stdlib.ring" see "working..." + nl see "Sum of first primes is prime:" + nl n = 0 num = 0 primSum = 0

while true

   n++
   if isprime(n)
      primSum += n
      if isprime(primSum)
         num++
         see "n" + "(" + num + ") = " + primsum + " is prime" + nl
      ok
   ok
   if num = 20
      exit
   ok

end

see "done..." + nl </lang>

Output:
working...
Sum of first primes is prime:
n(1) = 2 is prime
n(2) = 5 is prime
n(3) = 17 is prime
n(4) = 41 is prime
n(5) = 197 is prime
n(6) = 281 is prime
n(7) = 7699 is prime
n(8) = 8893 is prime
n(9) = 22039 is prime
n(10) = 24133 is prime
n(11) = 25237 is prime
n(12) = 28697 is prime
n(13) = 32353 is prime
n(14) = 37561 is prime
n(15) = 38921 is prime
n(16) = 43201 is prime
n(17) = 44683 is prime
n(18) = 55837 is prime
n(19) = 61027 is prime
n(20) = 66463 is prime
done...