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.

A352951 Primes p such that p+2, (p^2-5)/2-p, (p^2-1)/2+p, and (p^2+3)/2+3*p are all prime.

This page as a plain text file.
%I A352951 #24 Jun 12 2024 15:32:25
%S A352951 5,29,599,26699,59669,72869,189389,285839,389999,508619,623669,708989,
%T A352951 862229,908879,945629,945809,953789,1002149,1134389,1138409,1431569,
%U A352951 1461209,1712549,2110289,2127269,2158589,2704769,2727299,2837279,3004049,3068909,3091379,3280229,3336659,3402239,3546269
%N A352951 Primes p such that p+2, (p^2-5)/2-p, (p^2-1)/2+p, and (p^2+3)/2+3*p are all prime.
%C A352951 Lower twin primes p such that if q = p+2, then (p*q-1)/2, (p*q-1)/2-p-q and (p*q-1)/2+p+q are also prime.
%C A352951 All terms but the first == 29 (mod 30).
%H A352951 Robert Israel, <a href="/A352951/b352951.txt">Table of n, a(n) for n = 1..2500</a>
%e A352951 a(3)=599 is a term because it, 599+2 = 601, (599*601-1)/2 = 179999, 179999-599-601 = 178799, and 179999+599+601 = 181199 are prime.
%p A352951 R:= 5: count:= 0:
%p A352951 for p from 29 by 30 while count < 60 do
%p A352951   if isprime(p) and isprime(p+2) then
%p A352951     q:= p+2; r:= (p*q-1)/2;
%p A352951     if isprime(r) and isprime(r+p+q) and isprime(r-p-q) then
%p A352951       count:= count+1; R:= R,p;
%p A352951     fi
%p A352951   fi
%p A352951 od:
%p A352951 R;
%t A352951 Select[Prime[Range[250000]], And @@ PrimeQ[{# + 2, (#^2 - 5)/2 - #, (#^2 - 1)/2 + #, (#^2 + 3)/2 + 3*#}] &] (* _Amiram Eldar_, Apr 11 2022 *)
%t A352951 Select[Prime[Range[260000]],AllTrue[{#+2,(#^2-5)/2-#,(#^2-1)/2+#,(#^2+3)/2+3#},PrimeQ]&] (* _Harvey P. Dale_, Jun 12 2024 *)
%o A352951 (Python)
%o A352951 from itertools import islice
%o A352951 from sympy import isprime, nextprime
%o A352951 def agen(): # generator of terms
%o A352951     p, q = 3, 5
%o A352951     while True:
%o A352951         if q == p+2:
%o A352951             t, s = (p*q-1)//2, p+q
%o A352951             if isprime(t) and isprime(t+s) and isprime(t-s):
%o A352951                 yield p
%o A352951         p, q = q, nextprime(q)
%o A352951 print(list(islice(agen(), 36))) # _Michael S. Branicky_, Apr 10 2022
%Y A352951 Cf. A352948.
%Y A352951 Subsequence of A001359.
%K A352951 nonn
%O A352951 1,1
%A A352951 _J. M. Bergot_ and _Robert Israel_, Apr 10 2022