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.

A105411 Primes p = prime(k) such that both p+2 and prime(k+4)-2 are prime numbers.

Original entry on oeis.org

3, 17, 29, 59, 227, 269, 617, 1031, 1277, 1289, 1301, 1607, 1667, 1697, 2087, 2129, 2309, 2711, 2789, 3257, 3527, 3539, 3557, 3917, 4019, 4241, 4517, 4637, 4787, 5477, 5501, 5639, 6551, 7307, 8819, 8837, 8999, 9011, 10037, 10067, 10271, 10499, 12041
Offset: 1

Views

Author

Cino Hilliard, May 02 2005

Keywords

Comments

Essentially the same as A089629. - R. J. Mathar, Aug 28 2008

Examples

			prime(7) = 17, and both prime(7)+2 = 19 and prime(7+4)-2 = 29 are primes, so 17 is in the sequence.
		

Crossrefs

Programs

  • Magma
    [NthPrime(n): n in [1..1500] | IsPrime(NthPrime(n)+2) and IsPrime(NthPrime(n+4)-2)]; // Vincenzo Librandi, Sep 14 2015
  • Mathematica
    For[n = 1, n < 500, n++, If[PrimeQ[Prime[n] + 2],If[PrimeQ[Prime[n + 4] - 2], Print[Prime[n]]]]] (* Stefan Steinerberger, Feb 07 2006 *)
    Select[Partition[Prime[Range[1500]],5,1],AllTrue[{#[[1]]+2,#[[5]]-2},PrimeQ]&][[All,1]] (* Harvey P. Dale, Oct 28 2022 *)
  • PARI
    pnpk(n, m=4, k=2) = { local(x, v1, v2); for(x=1, n, v1 = prime(x)+ k; v2 = prime(x+m)-k; if(isprime(v1)&isprime(v2), print1(prime(x), ", ") ) ) ;} \\ corrected by Michel Marcus, Sep 14 2015
    
  • PARI
    lista(pmax) = {my(k = 1, p = primes(5)); forprime(p1 = p[#p], pmax, k++; p[#p] = p1; if(p[2]- p[1] == 2 && p[5] - p[4] == 2, print1(p[1], ", ")); for(i = 1, #p-1, p[i] = p[i+1]));} \\ Amiram Eldar, Oct 04 2024
    

Formula

a(n) = prime(A105410(n)-1). - Amiram Eldar, Oct 04 2024