A065117 Primes such that prime(p) +- pi(p) are simultaneously prime.
3, 113, 463, 593, 743, 1109, 2473, 4139, 4657, 4937, 5531, 5879, 6473, 6581, 6659, 6701, 7297, 7529, 8387, 8521, 8929, 9349, 10369, 10499, 12289, 12829, 13411, 13697, 14033, 14323, 15907, 18637, 19391, 19841, 21143, 21647, 23021, 27077
Offset: 1
Keywords
Examples
113 is in the sequence because PrimePi(113) is 30, Prime(113) is 617, and both 587 and 647 are primes.
Links
- Harry J. Smith, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Do[p0 = Prime[ Prime[n]]; p1 = PrimePi[ Prime[n]]; If[ PrimeQ[p0 + p1] && PrimeQ[p0 - p1], Print[ Prime[n]]], {n, 1, 5000} ] spQ[n_]:=Module[{p=PrimePi[n]},AllTrue[Prime[n]+{p,-p},PrimeQ]]; Select[ Prime[ Range[10000]],spQ] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 03 2018 *)
-
PARI
{ n=0; default(primelimit, 4294965247); for (m=1, 10^9, p=prime(m); p0 = prime(p); p1 = primepi(p); if (isprime(p0 + p1) && isprime(p0 - p1), write("b065117.txt", n++, " ", p); if (n==1000, return)) ) } \\ Harry J. Smith, Oct 10 2009
Extensions
Example corrected by Harvey P. Dale, Sep 03 2018
Comments