%I #8 Jun 11 2021 12:23:29
%S 0,0,0,0,0,0,0,0,0,0,0,0,13,0,13,0,17,0,0,0,0,13,0,17,13,0,17,0,0,0,
%T 31,0,0,31,0,0,37,0,0,0,0,13,13,17,17,13,0,17,0,0,31,31,0,37,13,0,17,
%U 37,0,13,0,17,13,31,17,0,37,0,31,0,71,31,73,0,37,73,0,0,79,0,13,0,17,71,13,0
%N a(n) is the least emirp k such that 2*n-k is also an emirp, or 0 if there are none.
%H Robert Israel, <a href="/A345191/b345191.txt">Table of n, a(n) for n = 1..10000</a>
%e a(24) = 17 because 2*24 = 17+31 where 17 and 31 are emirps.
%p revdigs:= proc(n) local L,i;
%p L:= convert(n,base,10);
%p add(L[-i]*10^(i-1),i=1..nops(L))
%p end proc:
%p filter:= proc(t) local r;
%p if not isprime(t) then return false fi;
%p r:= revdigs(t);
%p r <> t and isprime(r)
%p end proc:
%p N:= 1000: # for a(1)..a(N)
%p E:= select(filter, [seq(i,i=3..2*N,2)]);
%p f:= proc(n) local i,j,w,t;
%p t:= 2*n;
%p j:= ListTools:-BinaryPlace(E,t);
%p i:= 1;
%p while i <= j do
%p w:= E[i]+E[j];
%p if w = t then return E[i]
%p elif w < t then i:=i+1
%p else j:= j-1
%p fi
%p od;
%p 0
%p end proc:
%p map(f, [$1..N]);
%Y Cf. A006567
%K nonn,base,look
%O 1,13
%A _J. M. Bergot_ and _Robert Israel_, Jun 10 2021
|