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!)
A349586 First of four consecutive primes p,q,r,s such that 2*p+q+r+s, p+2*q+r+s, p+q+2*r+s and p+q+r+2*s are all prime. 1

%I #17 Nov 23 2021 18:18:23

%S 659,2351,3967,8429,15091,23599,25127,32789,34471,35171,60859,64969,

%T 75941,78367,95111,97649,115183,139891,155773,158803,161059,186023,

%U 191707,208933,224443,225949,235813,333341,335693,391789,411337,417119,418637,426541,435647,454253,476611,488339,489449,493169

%N First of four consecutive primes p,q,r,s such that 2*p+q+r+s, p+2*q+r+s, p+q+2*r+s and p+q+r+2*s are all prime.

%H Robert Israel, <a href="/A349586/b349586.txt">Table of n, a(n) for n = 1..10000</a>

%e a(3) = 3967 is a term because 3967, 3989, 4001, 4003 are four consecutive primes with 2*3967+3989+4001+4003=19927,

%e 3967+2*3989+4001+4003=19949,

%e 3967+3989+2*4001+4003=19961,

%e 3967+3989+4001+2*4003=19963, all prime.

%p R:= NULL: count:= 0:

%p q:= 2: r:= 3: s:= 5:

%p while count < 100 do

%p p:= q; q:= r; r:= s; s:= nextprime(s);

%p S:= p+q+r+s;

%p if isprime(p+S) and isprime(q+S) and isprime(r+S) and isprime(s+S) then

%p count:= count+1; R:= R, p;

%p fi

%p od:

%p R;

%t Select[Partition[Select[Range[500000], PrimeQ], 4, 1], And @@ PrimeQ[# + Total[#]] &][[;; , 1]] (* _Amiram Eldar_, Nov 22 2021 *)

%o (Python)

%o from sympy import isprime, nextprime

%o def aupto(limit):

%o p, q, r, s, alst = 2, 3, 5, 7, []

%o while p <= limit:

%o if all(isprime(p+q+r+s+k) for k in [p, q, r, s]): alst.append(p)

%o p, q, r, s = q, r, s, nextprime(s)

%o return alst

%o print(aupto(500000)) # _Michael S. Branicky_, Nov 22 2021

%o (PARI) list(lim)=my(v=List(),p,q,r); p=2;q=3;r=5; forprime(s=7,, if(p>lim, break); if(isprime(2*p+q+r+s) && isprime(p+2*q+r+s) && isprime(p+q+2*r+s) && isprime(p+q+r+2*s), listput(v,p)); p=q; q=r; r=s); Vec(v) \\ _Charles R Greathouse IV_, Nov 22 2021

%K nonn

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Nov 22 2021

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 April 24 03:08 EDT 2024. Contains 371918 sequences. (Running on oeis4.)