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.

A342705 Primes p such that (p^2 - p*q + q^2)/3 is prime, where q is the next prime after p.

This page as a plain text file.
%I A342705 #12 Mar 23 2021 05:40:54
%S A342705 5,7,13,17,19,59,97,101,107,109,191,223,229,277,283,569,613,631,643,
%T A342705 709,719,743,829,857,881,1031,1049,1051,1091,1109,1171,1193,1249,1277,
%U A342705 1301,1327,1489,1579,1637,1697,1949,1979,2003,2081,2089,2113,2141,2203,2357,2423,2539,2593,2659,2749,2789,2819
%N A342705 Primes p such that (p^2 - p*q + q^2)/3 is prime, where q is the next prime after p.
%C A342705 If p == -q (mod 3) then p^2 - p*q + q^2 is divisible by 3.
%H A342705 Robert Israel, <a href="/A342705/b342705.txt">Table of n, a(n) for n = 1..10000</a>
%e A342705 a(5) = 19 is a term because 19 and 23 are consecutive primes and (19^2 - 19*23 + 23^2)/3 = 151 is prime.
%p A342705 R:= NULL: q:= 2: count:= 0:
%p A342705 while count < 100 do
%p A342705   p:= q; q:= nextprime(p);
%p A342705   r:= (p^2-p*q+q^2)/3;
%p A342705   if r::integer and isprime(r) then
%p A342705     count:= count+1; R:= R, p;
%p A342705   fi;
%p A342705 od:
%p A342705 R;
%o A342705 (Python)
%o A342705 from sympy import isprime, nextprime
%o A342705 def aupto(limit):
%o A342705   p, q, num, alst = 2, 3, 7, []
%o A342705   while  p <= limit:
%o A342705     if num%3 == 0 and isprime(num//3): alst.append(p)
%o A342705     p, q = q, nextprime(q)
%o A342705     num = p**2 - p*q + q**2
%o A342705   return alst
%o A342705 print(aupto(2819)) # _Michael S. Branicky_, Mar 18 2021
%Y A342705 Cf. A339920, A342706.
%K A342705 nonn
%O A342705 1,1
%A A342705 _J. M. Bergot_ and _Robert Israel_, Mar 18 2021