%I #20 Jul 07 2024 02:59:05
%S 3,5,7,13,29,41,43,59,71,103,107,137,149,193,199,271,281,311,347,349,
%T 433,463,569,617,619,811,827,857,859,881,1031,1153,1229,1289,1481,
%U 1607,1699,1723,1933,1949,1951,1997,2113,2551,2593,2657,3001,3257,3373,3463
%N Primes p such that p is a twin prime and prime(prime(p)) is also a twin prime.
%H Amiram Eldar, <a href="/A087383/b087383.txt">Table of n, a(n) for n = 1..10000</a>
%e 29 is in the sequence because 29 and 31 are twin primes and prime(prime(29)) = prime(109) = 599, which is a twin prime with 601.
%t TwinPrimeQ[n_]:=If[PrimeQ[n], If[PrimeQ[n-2]||PrimeQ[n+2], True, False], False](*TwinPrimeQ*) lst={};Do[If[TwinPrimeQ[Prime[Prime[n]]]&&TwinPrimeQ[n], AppendTo[lst, n]], {n, 7!}];lst (* _Vladimir Joseph Stephan Orlovsky_, Sep 07 2008 *)
%o (PARI) twips(n) = { c1=0; c2=0; forprime(x=3,n, if(isprime(x+2),c1++); x1=prime(prime(x)); if(isprime(x-2) || isprime(x+2), if(isprime(x1-2) || isprime(x1+2), print1(x","); c2++; ) ) ); print(); print(c2/c1+.0) }
%Y Cf. A001097, A006450.
%K easy,nonn
%O 1,1
%A _Cino Hilliard_, Oct 21 2003