login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A105411 Numbers p(n) such that both p(n)+2 and p(n+4)-2 are prime numbers, where p(n) is the n-th prime number (A000040(n)). 0

%I #26 Oct 28 2022 18:29:43

%S 3,17,29,59,227,269,617,1031,1277,1289,1301,1607,1667,1697,2087,2129,

%T 2309,2711,2789,3257,3527,3539,3557,3917,4019,4241,4517,4637,4787,

%U 5477,5501,5639,6551,7307,8819,8837,8999,9011,10037,10067,10271,10499,12041

%N Numbers p(n) such that both p(n)+2 and p(n+4)-2 are prime numbers, where p(n) is the n-th prime number (A000040(n)).

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

%C Essentially the same as A089629. - _R. J. Mathar_, Aug 28 2008

%t 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 *)

%t Select[Partition[Prime[Range[1500]],5,1],AllTrue[{#[[1]]+2,#[[5]]-2},PrimeQ]&][[All,1]] (* _Harvey P. Dale_, Oct 28 2022 *)

%o (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

%o (Magma) [NthPrime(n): n in [1..1500] | IsPrime(NthPrime(n)+2) and IsPrime(NthPrime(n+4)-2)]; // _Vincenzo Librandi_, Sep 14 2015

%K nonn

%O 1,1

%A _Cino Hilliard_, May 02 2005

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 20 12:27 EDT 2024. Contains 375331 sequences. (Running on oeis4.)