OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..1000
EXAMPLE
a(3) = 32687 is an emirp because 32687 and 78623 are distinct primes. The sum of digits of 32687 is 26. 32687+26 = 32713 and 78623+26 = 78649 are emirps because 32713 and 31723 are distinct primes, as are 78649 and 94687.
MAPLE
revdigs:= proc(n) local L, i;
L:= convert(n, base, 10);
add(10^(i-1)*L[-i], i=1..nops(L))
end proc:
filter:= proc(n) local r, t, n2, n3;
if not isprime(n) then return false fi;
r:= revdigs(n);
if r = n or not isprime(r) then return false fi;
t:= convert(convert(n, base, 10), `+`);
for n2 in [n+t, r+t] do
if not isprime(n2) then return false fi;
r:= revdigs(n2);
if r = n2 or not isprime(r) then return false fi;
od;
true
end proc:
select(filter, [seq(i, i=13..10^6, 2)]);
PROG
(Python)
from sympy import isprime
def sd(n): return sum(map(int, str(n)))
def emirp(n):
if not isprime(n): return False
revn = int(str(n)[::-1])
if n == revn: return False
return isprime(revn)
def ok(n):
if not emirp(n): return False
if not emirp(n + sd(n)): return False
revn = int(str(n)[::-1])
return emirp(revn + sd(revn))
def aupto(nn): return [m for m in range(1, nn+1) if ok(m)]
print(aupto(920000)) # Michael S. Branicky, Jan 24 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
J. M. Bergot and Robert Israel, Jan 23 2021
STATUS
approved