%I #25 May 27 2024 07:14:16
%S 44,1090,10450,5104,88888,10780,289982,299992,482174,478874,868868,
%T 499994,1073270,1087790,1071070,1069970,10904990,10794980,1091090,
%U 10892990,1100000,29955992,1101100,26688662,31022002,27599572,46400354,44688644,29821792,45289244,30122092,26988962
%N a(n) is the least number that is the sum of an emirp and its reversal in exactly n ways.
%C Interchanging an emirp and its reversal is not counted as a different way.
%C a(n) is the least number k such that there are exactly n unordered pairs of distinct primes (p,p') such that p' is the digit reversal of p and p+p' = k.
%C Are terms not divisible by 3? _Amiram Eldar_ finds proof they are; A056964(n) = n + reverse(n) is divisible by 3 if and only if n is divisible by 3. But emirps are primes (other than 3) so they are not divisible by 3. - _David A. Corneth_, Jun 19 2021
%H David A. Corneth, <a href="/A345410/b345410.txt">Table of n, a(n) for n = 1..423</a>
%H David A. Corneth, <a href="/A345410/a345410.gp.txt">A few examples</a>
%e a(3) = 10450 because 10450 = 1229+9221 = 1409+9041 = 3407+7043.
%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..5)]):
%p V:= sort(map(t -> t+revdigs(t),E)):
%p N:= nops(V):
%p W:= Vector(16):
%p i:= 1:
%p while i < N do
%p for j from 1 to N-i while V[i+j]=V[i] do od:
%p if j <= 16 and W[j] = 0 then W[j]:= V[i] fi;
%p i:= i+j;
%p od:
%p convert(W,list);
%o (Python)
%o from itertools import product
%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 digits = 2
%o while True:
%o for first in "1379":
%o for last in "1379":
%o if last < first: continue
%o for mid in product("0123456789", repeat=digits-2):
%o strp = first + "".join(mid) + last
%o revstrp = strp[::-1]
%o if strp >= revstrp: continue
%o p = int(strp)
%o if p > end: return
%o revp = int(strp[::-1])
%o if isprime(p) and isprime(revp): yield (p, revp)
%o digits += 1
%o def aupto(lim):
%o alst = []
%o c = Counter(sum(ep) for ep in epgen(1, lim) if sum(ep) <= lim)
%o r = set(c.values())
%o for i in range(1, max(r)+1):
%o if i in r: alst.append(min(s for s in c if c[s] == i))
%o else: break
%o return alst
%o print(aupto(11*10**5)) # _Michael S. Branicky_, Jun 19 2021
%Y Cf. A006567, A345408, A345409.
%K nonn,base
%O 1,1
%A _J. M. Bergot_ and _Robert Israel_, Jun 18 2021
%E More terms from _David A. Corneth_, Jun 18 2021