OFFSET
1,1
LINKS
John-Å. W. Olsen, Table of n, a(n) for n = 1..1000
EXAMPLE
n = 1; p = 2; q = 3;
n = 2; p = 3; q = 5;
n = 3; p = 5; q = 3;
n = 4; p = 7; q = 3;
MATHEMATICA
a[n_] := Block[{q = 3, p = Prime@n}, While[! PrimeQ[p*q + p + q], q = NextPrime@q]; q]; Array[a, 101] (* Giovanni Resta, May 11 2013 *)
PROG
(PARI) a(n) = my(q=3, p=prime(n)); while(!isprime(p*q+p+q), q = nextprime(q+1)); q; \\ Michel Marcus, Sep 06 2021
(Python)
from sympy import isprime, nextprime, prime
def a(n):
q, p = 3, prime(n)
while not isprime(p*q + p + q): q = nextprime(q)
return q
print([a(n) for n in range(1, 102)]) # Michael S. Branicky, Sep 06 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
John-Å. W. Olsen, May 11 2013
STATUS
approved