login
Primes of the form p*q*(p+q)+1 where (p,q) is a twin prime pair.
1

%I #14 Aug 17 2024 15:25:50

%S 421,3433,431881,746353,2122213,84287689,161242273,574990681,

%T 1372256173,6589289569,8315492209,13246972549,40692828541,52396140061,

%U 75866105281,77916431221,82987207333,91919299573,140685402049,152665872493,188144420089,199536434869,265301989801,404110652329,406594932241

%N Primes of the form p*q*(p+q)+1 where (p,q) is a twin prime pair.

%H Robert Israel, <a href="/A353045/b353045.txt">Table of n, a(n) for n = 1..10000</a>

%e a(3) = 431881 is a term because (59, 61) is a twin prime pair with 59*61*(59+61)+1 = 431881, and 431881 is prime.

%p P:= select(isprime, {seq(i,i=3..10^6,2)}):

%p T:= P intersect map(`-`,P,2):

%p R:= map(t -> t*(t+2)*(2*t+2)+1, T):

%p sort(convert(select(isprime,R),list));

%t Select[#[[1]]#[[2]]Total[#]+1&/@Select[Partition[Prime[Range[1000]],2,1],#[[2]]-#[[1]] == 2&],PrimeQ] (* _Harvey P. Dale_, Aug 17 2024 *)

%o (Python)

%o from itertools import islice

%o from sympy import isprime, nextprime

%o def agen(): # generator of terms

%o p, q = 3, 5

%o while True:

%o if q == p+2:

%o t = p*q*(p+q)+1

%o if isprime(t):

%o yield t

%o p, q = q, nextprime(q)

%o print(list(islice(agen(), 25))) # _Michael S. Branicky_, Apr 19 2022

%Y Cf. A001359.

%K nonn

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Apr 19 2022