login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A340843 Emirps p such that p+(sum of digits of p) and reverse(p)+(sum of digits of p) are emirps. 2

%I #16 Jan 25 2021 19:03:05

%S 1933,3391,32687,78623,104087,109891,112103,120283,123127,135469,

%T 136217,161983,162209,162391,163819,179779,193261,198613,198901,

%U 301211,316819,316891,382021,389161,712631,721321,726487,738349,780401,784627,902261,918361,918613,943837,964531,977971,1002247

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

%H Robert Israel, <a href="/A340843/b340843.txt">Table of n, a(n) for n = 1..1000</a>

%e 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 revdigs:= proc(n) local L,i;

%p L:= convert(n,base,10);

%p add(10^(i-1)*L[-i],i=1..nops(L))

%p end proc:

%p filter:= proc(n) local r,t,n2,n3;

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

%p r:= revdigs(n);

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

%p t:= convert(convert(n,base,10),`+`);

%p for n2 in [n+t, r+t] do

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

%p r:= revdigs(n2);

%p if r = n2 or not isprime(r) then return false fi;

%p od;

%p true

%p end proc:

%p select(filter, [seq(i,i=13..10^6,2)]);

%o (Python)

%o from sympy import isprime

%o def sd(n): return sum(map(int, str(n)))

%o def emirp(n):

%o if not isprime(n): return False

%o revn = int(str(n)[::-1])

%o if n == revn: return False

%o return isprime(revn)

%o def ok(n):

%o if not emirp(n): return False

%o if not emirp(n + sd(n)): return False

%o revn = int(str(n)[::-1])

%o return emirp(revn + sd(revn))

%o def aupto(nn): return [m for m in range(1, nn+1) if ok(m)]

%o print(aupto(920000)) # _Michael S. Branicky_, Jan 24 2021

%Y Cf. A006567. Contained in A340842.

%K nonn,base

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Jan 23 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)