login
Twin primes p such that the absolute difference of p and the reverse of its twin is a twin prime.
2

%I #11 Mar 07 2021 17:31:03

%S 31,41,43,59,281,283,827,829,857,859,2081,2083,2381,2593,2711,2801,

%T 2803,4003,4273,4517,4933,6359,6689,6947,8087,8089,8387,8537,8599,

%U 8627,8839,20479,20509,20809,20981,20983,21019,21191,21193,21319,21379,21491,21493,21523,21589,21739,22699,22741,23059

%N Twin primes p such that the absolute difference of p and the reverse of its twin is a twin prime.

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

%e For n = 4, 59 is a twin prime, the reverse of its twin 61 is 16, and |59 - 16| = 43 is a twin prime, so 59 is in the sequence.

%p digrev:= proc(n) local L,i;

%p L:= convert(n,base,10);

%p add(10^(i-1)*L[-i],i=1..nops(L))

%p end proc:

%p filter:= proc(p,q) local t;

%p t:= abs(p - digrev(q));

%p isprime(t) and (isprime(t-2) or isprime(t+2))

%p end proc:

%p q:= 2: R:= NULL: count:= 0:

%p while count < 100 do

%p p:= q; q:= nextprime(q);

%p if q-p = 2 then

%p if filter(p,q) then count:= count+1; R:= R, p fi;

%p if filter(q,p) then count:= count+1; R:= R, q fi;

%p fi

%p od:

%p R;

%Y Cf. A004086, A001097.

%K nonn,base

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Mar 05 2021