A064403 Numbers k such that prime(k) + k and prime(k) - k are both primes.
4, 6, 18, 42, 66, 144, 282, 384, 408, 450, 522, 564, 618, 672, 720, 732, 744, 828, 858, 1122, 1308, 1374, 1560, 1644, 1698, 1776, 1848, 1920, 2022, 2304, 2412, 2616, 2766, 2778, 2874, 2958, 2970, 3036, 3042, 3240, 3258, 3354, 3360, 3432, 3540, 3594, 3732
Offset: 1
Keywords
Examples
4 is in the sequence because the fourth prime is 7 and both 7+4 and 7-4 are primes.
Links
- Harry J. Smith, Table of n, a(n) for n = 1..1000
Crossrefs
Cf. A143794 (corresponding primes).
Programs
-
Mathematica
Select[ Range[ 4000 ], PrimeQ[ Prime[ # ] + # ] && PrimeQ[ Prime[ # ] - # ] & ]; Join[{4},Select[ Range[6, 4000,6 ], PrimeQ[Prime[ # ] + # ] && PrimeQ[ Prime[ # ] - # ] & ]] (* Zak Seidov, Jan 04 2013 *) Select[Range[4000],AllTrue[Prime[#]+{#,-#},PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 25 2019 *)
-
PARI
{ n=0; default(primelimit, 1800000); for (m=1, 10^9, if (isprime(prime(m) + m) && isprime(prime(m) - m), write("b064403.txt", n++, " ", m); if (n==1000, break)) ) } \\ Harry J. Smith, Sep 13 2009
Comments