cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A340843 Emirps p such that p+(sum of digits of p) and reverse(p)+(sum of digits of p) are emirps.

This page as a plain text file.
%I A340843 #16 Jan 25 2021 19:03:05
%S A340843 1933,3391,32687,78623,104087,109891,112103,120283,123127,135469,
%T A340843 136217,161983,162209,162391,163819,179779,193261,198613,198901,
%U A340843 301211,316819,316891,382021,389161,712631,721321,726487,738349,780401,784627,902261,918361,918613,943837,964531,977971,1002247
%N A340843 Emirps p such that p+(sum of digits of p) and reverse(p)+(sum of digits of p) are emirps.
%H A340843 Robert Israel, <a href="/A340843/b340843.txt">Table of n, a(n) for n = 1..1000</a>
%e A340843 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.
%p A340843 revdigs:= proc(n) local L,i;
%p A340843   L:= convert(n,base,10);
%p A340843   add(10^(i-1)*L[-i],i=1..nops(L))
%p A340843 end proc:
%p A340843 filter:= proc(n) local r,t,n2,n3;
%p A340843 if not isprime(n) then return false fi;
%p A340843 r:= revdigs(n);
%p A340843 if r = n or not isprime(r) then return false fi;
%p A340843 t:= convert(convert(n,base,10),`+`);
%p A340843 for n2 in [n+t, r+t] do
%p A340843   if not isprime(n2) then return false fi;
%p A340843   r:= revdigs(n2);
%p A340843   if r = n2 or not isprime(r) then return false fi;
%p A340843 od;
%p A340843 true
%p A340843 end proc:
%p A340843 select(filter, [seq(i,i=13..10^6,2)]);
%o A340843 (Python)
%o A340843 from sympy import isprime
%o A340843 def sd(n): return sum(map(int, str(n)))
%o A340843 def emirp(n):
%o A340843   if not isprime(n): return False
%o A340843   revn = int(str(n)[::-1])
%o A340843   if n == revn: return False
%o A340843   return isprime(revn)
%o A340843 def ok(n):
%o A340843   if not emirp(n): return False
%o A340843   if not emirp(n + sd(n)): return False
%o A340843   revn = int(str(n)[::-1])
%o A340843   return emirp(revn + sd(revn))
%o A340843 def aupto(nn): return [m for m in range(1, nn+1) if ok(m)]
%o A340843 print(aupto(920000)) # _Michael S. Branicky_, Jan 24 2021
%Y A340843 Cf. A006567. Contained in A340842.
%K A340843 nonn,base
%O A340843 1,1
%A A340843 _J. M. Bergot_ and _Robert Israel_, Jan 23 2021