Prime numbers p for which the sum of primes less than or equal to p is prime

From Rosetta Code
Revision as of 15:39, 7 July 2021 by CalmoSoft (talk | contribs) (Created page with "{{Draft task}} ;Task:Find prime numbers '''p''' which sum of prime numbers less or equal to '''p''' is prime, where '''p < 1000''' <br><br> =={{header|Ring}}== <lang ring>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Prime numbers p for which the sum of primes less than or equal to p 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
Find prime numbers p which sum of prime numbers less or equal to p is prime, where p < 1000



Ring

<lang ring> load "stdlib.ring" see "working..." + nl see "Prime numbers p which sum of prime numbers less or equal to p is prime:" + nl

row = 0 sum = 0 limit = 1000

for n = 1 to limit

   if isprime(n)
      sum = sum + n
      if isprime(sum)    
         see "" + n + " " 
         row = row + 1
         if row%5 = 0
            see nl
         ok
      ok
   ok

next

see nl + "Found " + row + " numbers" + nl see "done..." + nl </lang>

Output:
working...
Prime numbers p which sum of prime numbers less or equal to p is prime:
2 3 7 13 37 
43 281 311 503 541 
557 593 619 673 683 
733 743 839 881 929 
953 
Found 21 numbers
done...