OFFSET
1,1
LINKS
Zak Seidov, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1)=3 because p=prime(1)=2 and both P=3^2-2=7 and Q=3^2+2=11 are prime;
a(3)=6 because p=5 and both P=31 and Q=41 are prime;
a(10000)=510 because p=104729 and both P=155371 and Q=364829 are prime.
MATHEMATICA
lnm[n_]:=Module[{m=2, pr=Prime[n]}, If[m^2-pr<0, m=Ceiling[Sqrt[pr]]]; While[ !AllTrue[m^2+{pr, -pr}, PrimeQ], m++]; m]; Array[lnm, 80] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Nov 22 2014 *)
PROG
(PARI) a(n) = { p = prime(n); m = sqrtint(p); until( isprime(m^2-p) && isprime(m^2+p), m++); m} \\ Michel Marcus, Oct 13 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Oct 13 2014
STATUS
approved