%I #9 Feb 27 2023 11:04:46
%S 19,109,433,1327,4567,6079,19687,49927,62233,103813,160087,172801,
%T 238573,363313,395323,463363,583447,640333,753007,1145773,1529413,
%U 1728247,1968301,2056753,2223967,2317927,2349679,2413927,3121201,3577393,4148953,4298443
%N Primes of the form p^2 + pq + q^2, where p and q are consecutive primes.
%H K. D. Bajpai, <a href="/A243761/b243761.txt">Table of n, a(n) for n = 1..8900</a>
%e 19 is in the sequence because 2^2 + 2*3 + 3^2 = 19 is prime: 2 and 3 are consecutive primes.
%e 109 is in the sequence because 5^2 + 5*7 + 7^2 = 109 is prime: 5 and 7 are consecutive primes.
%p with(numtheory): A243761:= proc() local k, p, q; p:=ithprime(n); q:=ithprime(n+1); k:=p^2 + p*q + q^2; if isprime(k) then RETURN (k); fi; end: seq(A243761 (), n=1..500);
%t Select[Table[Prime[n]^2 + Prime[n] Prime[n + 1] + Prime[n + 1]^2, {n, 500}], PrimeQ[#] &]
%o (Python)
%o from itertools import islice
%o from sympy import isprime, nextprime
%o def A243761_gen(): # generator of terms
%o p, q = 2, 3
%o while True:
%o if isprime(r:=p*(p+q)+q**2):
%o yield r
%o p, q = q, nextprime(q)
%o A243761_list = list(islice(A243761_gen(),20)) # _Chai Wah Wu_, Feb 27 2023
%Y Cf. A000040, A007645, A003136.
%K nonn
%O 1,1
%A _K. D. Bajpai_, Jun 10 2014
|