Prime triplets
Prime triplets 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 and show members of prime triples (p, p+2, p+6), where p < 5500
Ring
<lang ring> load "stdlib.ring" see "working..." + nl see "Initial members of prime triples (p, p+2, p+6) are:" + nl
row = 0 limit = 5500
for n = 1 to limit
if isprime(n) and isprime(n+2) and isprime(n+6) row = row + 1 see "" + n + " " if row%5 = 0 see nl ok ok
next
see nl + "Found " + row + " primes" + nl see "done..." + nl </lang>
- Output:
working... Initial members of prime triples (p, p+2, p+6): 5 11 17 41 101 107 191 227 311 347 461 641 821 857 881 1091 1277 1301 1427 1481 1487 1607 1871 1997 2081 2237 2267 2657 2687 3251 3461 3527 3671 3917 4001 4127 4517 4637 4787 4931 4967 5231 5477 Found 43 primes done...