login
Lesser of twin primes p, p+2 such that prime(p) and prime(p+2) are also twin primes.
1

%I #14 Mar 06 2020 10:43:36

%S 3,5,11,41,461,1031,1619,2309,2789,7877,8219,9929,11117,12071,16067,

%T 18251,18911,22091,23909,26681,28751,30467,32531,33809,38747,40847,

%U 41201,41609,43397,46769,49169,56711,58907,73061,79631,89069,91457,92957,96179,110567,113327,114641,117989,122399,123491

%N Lesser of twin primes p, p+2 such that prime(p) and prime(p+2) are also twin primes.

%H Chai Wah Wu, <a href="/A332968/b332968.txt">Table of n, a(n) for n = 1..10000</a> (n = 1..699 from Robert Israel)

%e a(3) = 11 is a member because it is the lesser of the twin prime pair (11,13), and prime(11) = 31 and prime(13) = 41 are both twin primes.

%p P:= select(isprime,[2,seq(i,i=3..2*10^5,2)]):

%p nP:= nops(P):

%p T:= P[select(i-> P[i+1]=P[i]+2,[$1..nP-1])]:

%p TS:= select(`<=`,T,nP-3):

%p select(t -> (P[t]+2=P[t+1] or P[t]-2=P[t-1]) and (P[t+2]+2=P[t+3] or P[t+2]-2=P[t+1]), TS);

%Y Cf. A001359, A006450.

%K nonn

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Mar 04 2020