OFFSET
1,1
LINKS
K. D. Bajpai, Table of n, a(n) for n = 1..1119
EXAMPLE
7 is prime and appears in the sequence: prime(7^2) = 227 and 227+2 = 229, which is also prime.
53 is prime and appears in the sequence: prime(53^2) = 25469 and 25469+2 = 25471, which is also prime.
MAPLE
KD := proc() local a, b; a:=ithprime(n); b:=ithprime(a^2)+2; if isprime (b) then RETURN (a); fi; end: seq(KD(), n=1..700);
MATHEMATICA
Select[Prime[Range[600]], PrimeQ[Prime[#^2]+2]&] (* Harvey P. Dale, Aug 29 2021 *)
PROG
(PARI)
default(primelimit, 2^31)
s=[]; forprime(p=2, 4000, if(isprime(prime(p^2)+2), s=concat(s, p))); s \\ Colin Barker, Jan 30 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
K. D. Bajpai, Jan 29 2014
STATUS
approved