OFFSET
1,1
COMMENTS
Interchanging an emirp and its reversal is not counted as a different way.
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.
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
LINKS
David A. Corneth, Table of n, a(n) for n = 1..423
David A. Corneth, A few examples
EXAMPLE
a(3) = 10450 because 10450 = 1229+9221 = 1409+9041 = 3407+7043.
MAPLE
revdigs:= proc(n) local L, i; L:= convert(n, base, 10); add(L[-i]*10^(i-1), i=1..nops(L)) end proc:
isemirp1:= proc(n) local r;
if not isprime(n) then return false fi;
r:= revdigs(n);
r > n and isprime(r)
end proc:
E:= select(isemirp1, [seq(seq(seq(i*10^d+j, j=1..10^d-1, 2), i=[1, 3, 7, 9]), d=1..5)]):
V:= sort(map(t -> t+revdigs(t), E)):
N:= nops(V):
W:= Vector(16):
i:= 1:
while i < N do
for j from 1 to N-i while V[i+j]=V[i] do od:
if j <= 16 and W[j] = 0 then W[j]:= V[i] fi;
i:= i+j;
od:
convert(W, list);
PROG
(Python)
from itertools import product
from collections import Counter
from sympy import isprime, nextprime
def epgen(start=1, end=float('inf')): # generates unique emirp/prime pairs
digits = 2
while True:
for first in "1379":
for last in "1379":
if last < first: continue
for mid in product("0123456789", repeat=digits-2):
strp = first + "".join(mid) + last
revstrp = strp[::-1]
if strp >= revstrp: continue
p = int(strp)
if p > end: return
revp = int(strp[::-1])
if isprime(p) and isprime(revp): yield (p, revp)
digits += 1
def aupto(lim):
alst = []
c = Counter(sum(ep) for ep in epgen(1, lim) if sum(ep) <= lim)
r = set(c.values())
for i in range(1, max(r)+1):
if i in r: alst.append(min(s for s in c if c[s] == i))
else: break
return alst
print(aupto(11*10**5)) # Michael S. Branicky, Jun 19 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
J. M. Bergot and Robert Israel, Jun 18 2021
EXTENSIONS
More terms from David A. Corneth, Jun 18 2021
STATUS
approved