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.

A342706 Primes of the form (p^2 - p*q + q^2)/3, where p and q are consecutive primes.

This page as a plain text file.
%I A342706 #12 Dec 31 2023 17:23:36
%S A342706 13,31,79,109,151,1201,3271,3469,3889,4111,12289,16879,17791,25951,
%T A342706 27673,108301,126079,134857,138679,169957,174259,186019,231877,245389,
%U A342706 259309,355009,367501,371737,397489,412939,461017,477619,524197,544429,565069,602401,741031,833191,904303,961069,1267501
%N A342706 Primes of the form (p^2 - p*q + q^2)/3, where p and q are consecutive primes.
%H A342706 Robert Israel, <a href="/A342706/b342706.txt">Table of n, a(n) for n = 1..10000</a>
%e A342706 For n = 5, p = 19 and q = 23 are consecutive primes and a(5) = (19^2-19*23+23^2)/3 = 151 is prime.
%p A342706 R:= NULL: q:= 2: count:= 0:
%p A342706 while count<100 do
%p A342706   p:= q; q:= nextprime(p);
%p A342706   r:= (p^2-p*q+q^2)/3;
%p A342706   if r::integer and isprime(r) then
%p A342706     count:= count+1; R:= R, r;
%p A342706   fi;
%p A342706 od:
%p A342706 R;
%t A342706 cpQ[{a_,b_}]:=Module[{c=(a^2-a*b+b^2)/3},If[PrimeQ[c],c,Nothing]]; cpQ/@Partition[Prime[ Range[ 500]],2,1] (* _Harvey P. Dale_, Dec 31 2023 *)
%o A342706 (Python)
%o A342706 from sympy import isprime, nextprime
%o A342706 def aupto(limit):
%o A342706   p, q, num, alst = 3, 5, 7, []
%o A342706   while num//3 <= limit:
%o A342706     if num%3 == 0 and isprime(num//3): alst.append(num//3)
%o A342706     p, q, num = q, nextprime(q), p**2 - p*q + q**2
%o A342706   return alst
%o A342706 print(aupto(1267501)) # _Michael S. Branicky_, Mar 18 2021
%Y A342706 Cf. A339698, A342705.
%K A342706 nonn
%O A342706 1,1
%A A342706 _J. M. Bergot_ and _Robert Israel_, Mar 18 2021