OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
For n = 5, p = 19 and q = 23 are consecutive primes and a(5) = (19^2-19*23+23^2)/3 = 151 is prime.
MAPLE
R:= NULL: q:= 2: count:= 0:
while count<100 do
p:= q; q:= nextprime(p);
r:= (p^2-p*q+q^2)/3;
if r::integer and isprime(r) then
count:= count+1; R:= R, r;
fi;
od:
R;
MATHEMATICA
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 *)
PROG
(Python)
from sympy import isprime, nextprime
def aupto(limit):
p, q, num, alst = 3, 5, 7, []
while num//3 <= limit:
if num%3 == 0 and isprime(num//3): alst.append(num//3)
p, q, num = q, nextprime(q), p**2 - p*q + q**2
return alst
print(aupto(1267501)) # Michael S. Branicky, Mar 18 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Mar 18 2021
STATUS
approved