%I #9 Jun 18 2021 19:50:42
%S 44,88,110,176,424,808,908,928,1070,1090,1150,1190,1312,1372,1616,
%T 1676,1736,2222,2332,2552,2662,2992,3212,4114,4334,4444,4664,4774,
%U 4994,5104,5324,5434,6226,6776,6886,7106,7436,8338,8558,8998,9218,9328,9548,10010,10120,10450,10670,10780,11000,11110
%N Numbers that are the sum of an emirp and its reversal.
%H Robert Israel, <a href="/A345409/b345409.txt">Table of n, a(n) for n = 1..10000</a>
%e a(3) = 110 is a member because 110 = 37+73 where 37 is an emirp.
%p revdigs:= proc(n) local L,i; L:= convert(n,base,10); add(L[-i]*10^(i-1),i=1..nops(L)) end proc:
%p f:= proc(n) local r;
%p if not isprime(n) then return NULL fi;
%p r:= revdigs(n);
%p if r > n and isprime(r) then return r+n fi
%p end proc:
%p S:= map(f, {seq(seq(seq(i*10^d+j,j=1..10^d-1,2),i=[1,3,7,9]),d=1..4)}):
%p sort(convert(S,list));
%o (Python)
%o from sympy import isprime, nextprime
%o def epgen(start=1, end=float('inf')): # generates unique emirp/prime pairs
%o p = nextprime(start-1)
%o while p <= end:
%o revp = int(str(p)[::-1])
%o if p < revp and isprime(revp): yield (p, revp)
%o p = nextprime(p)
%o def aupto(lim):
%o epsums = set(sum(ep) for ep in epgen(1, lim))
%o return sorted(filter(lambda x: x<=lim, epsums))
%o print(aupto(11111)) # _Michael S. Branicky_, Jun 18 2021
%Y Cf. A006567, A345408.
%K nonn
%O 1,1
%A _J. M. Bergot_ and _Robert Israel_, Jun 18 2021
|