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.

Showing 1-1 of 1 results.

A231332 Primes p = prime(k) such that p - 2k and p + 2k are prime.

Original entry on oeis.org

17, 23, 37, 89, 113, 151, 307, 463, 557, 643, 701, 761, 863, 911, 977, 1019, 1069, 1093, 1427, 1481, 1733, 1867, 2521, 2687, 2731, 2753, 3163, 3221, 3581, 3623, 3877, 4139, 4243, 4621, 4643, 4783, 4861, 4889, 4937, 5443, 5569, 5807, 5903, 6619, 6701, 6761, 6871
Offset: 1

Views

Author

Zak Seidov, Jan 07 2014

Keywords

Comments

Corresponding values of k: 7, 9, 12, 24, 30, 36, 63, 90, 102, 117, 126, 135, 150. All except the first one, 7, are multiples of 3.

Examples

			17 is the seventh prime, and 17 - 2 * 7 = 3 and 17 + 2 * 7 = 31, both of which are prime, so 17 is in the sequence.
23 is the ninth prime, and 23 - 2 * 9 = 5 and 23 + 2 * 9 = 41, both of which are prime, so 23 is in the sequence.
29 is the tenth prime, and 29 - 2 * 10 = 9 and 29 + 2 * 10 = 49, neither of which is prime, so 29 is not in the sequence.
		

Crossrefs

Intersection of A231232 and A231326. Cf. A000040, A231506, A014689

Programs

  • Mathematica
    Reap[Sow[17]; Do[p = Prime[k]; If[PrimeQ[p + 2 * k] && PrimeQ[p - 2 * k], Sow[p]], {k, 9, 10^3, 3}]][[2, 1]]
    Select[Table[{n, Prime[n]},{n,1000}],AllTrue[#[[2]]+{2#[[1]],-2#[[1]]},PrimeQ]&][[All,2]] (* Harvey P. Dale, Aug 05 2022 *)
  • PARI
    {print(17","); forstep(k=9,885,3,p=prime(k);if(isprime(p+2*k)&& isprime(p-2*k),print(p",")))}
    
  • PARI
    k=0;forprime(p=2,1e6,k++;if(isprime(p-2*k) && isprime(2+2*k), print1(p", "))) \\ Charles R Greathouse IV, Jan 07 2014
Showing 1-1 of 1 results.