OFFSET
3,1
COMMENTS
If Goldbach's conjecture is true, this sequence is defined for all n.
EXAMPLE
For n = 3, prime(3) = 5, and a(3) = 3 because 5 + 1 - 3 = 3 is prime;
For n = 4, prime(4) = 7, and a(4) = 3 because 7 + 1 - 3 = 5 is prime;
...
for n = 25, prime(n) = 97, and a(n) = 19 because 97 + 1 - 19 = 79 is prime.
MATHEMATICA
f[n_] := Block[{i = 2, p = Prime[n + 2]},
While[q = Prime[i]; ! PrimeQ[p + 1 - q], i++]; q]; Array[f, 60]
PROG
(PARI) a(n) = my(p=prime(n), q=2); while (!isprime(p+1-q), q = nextprime(q+1)); q; \\ Michel Marcus, Apr 01 2020
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Lei Zhou, Jan 06 2011
EXTENSIONS
More terms from Michel Marcus, Apr 01 2020
STATUS
approved