Neighbour primes

From Rosetta Code
Neighbour primes 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 primes p such that p*q+2 is prime, where q is next prime after p, where p < 500

Ring

<lang ring> load "stdlib.ring" see "working..." + nl see "Neighbour primes are:" + nl see "p q p*q+2" + nl

row = 0 num = 0 pr = 0 limit = 100 Primes = []

while true

   pr = pr + 1
   if isprime(pr)
      add(Primes,pr)
      num = num + 1
      if num = limit 
         exit
      ok
   ok

end

for n = 1 to limit-1

   prim = Primes[n]*Primes[n+1]+2
   if isprime(prim)
      row = row + 1
      see "" + Primes[n] + " " + Primes[n+1] + " " + prim + nl
   ok

next

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

Output:
working...
Neighbour primes are:
p q p*q+2
3 5 17
5 7 37
7 11 79
13 17 223
19 23 439
67 71 4759
149 151 22501
179 181 32401
229 233 53359
239 241 57601
241 251 60493
269 271 72901
277 281 77839
307 311 95479
313 317 99223
397 401 159199
401 409 164011
419 421 176401
439 443 194479
487 491 239119
Found 20 neighbour primes
done...