login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers that are the sum of an emirp and its reversal in more than one way.
3

%I #11 Jun 18 2021 20:43:32

%S 1090,2662,2992,3212,4334,4994,5104,5324,6776,7106,9328,9548,10450,

%T 10670,10780,11110,11330,11440,11660,12122,12452,12892,13222,15004,

%U 16786,17446,17666,29092,29482,31912,36352,44644,44834,45454,46654,46664,47474,47864,49094,49294,49484,49684,49894,50104

%N Numbers that are the sum of an emirp and its reversal in more than one way.

%C Numbers that are in A345409 in more than one way.

%C Interchanging an emirp and its reversal is not counted as a different way.

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

%e a(3) = 2992 is a member because 2992 = 1091 + 1901 = 1181+1811 where 1091 and 1181 and their reversals 1901 and 1811 are primes.

%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 isemirp1:= proc(n) local r;

%p if not isprime(n) then return false fi;

%p r:= revdigs(n);

%p r > n and isprime(r)

%p end proc:

%p E:= select(isemirp1, [seq(seq(seq(i*10^d+j,j=1..10^d-1,2),i=[1,3,7,9]),d=1..4)]):

%p V:= sort(map(t -> t+revdigs(t),E)):

%p M:= select(t -> V[t+1]=V[t], [$1..nops(V)-1]):

%p sort(convert(convert(V[M],set),list));

%o (Python)

%o from collections import Counter

%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 c = Counter(sum(ep) for ep in epgen(1, lim) if sum(ep) <= lim)

%o return sorted(s for s in c if c[s] > 1)

%o print(aupto(50105)) # _Michael S. Branicky_, Jun 18 2021

%Y Cf. A006567, A345409.

%K nonn,base

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Jun 18 2021