cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A064403 Numbers k such that prime(k) + k and prime(k) - k are both primes.

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Sep 28 2001

Keywords

Comments

Starting with 6 all terms are == 0 (mod 6). - Zak Seidov, Jan 04 2013

Examples

			4 is in the sequence because the fourth prime is 7 and both 7+4 and 7-4 are primes.
		

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