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.

Showing 1-1 of 1 results.

A340842 Emirps p such that p + (sum of digits of p) is an emirp.

Original entry on oeis.org

13, 71, 97, 701, 1061, 1223, 1597, 1847, 1933, 3067, 3089, 3373, 3391, 3889, 7027, 7043, 7577, 9001, 9241, 9421, 10061, 10151, 10333, 10867, 11057, 11657, 11677, 11897, 11923, 12227, 12269, 12809, 13147, 13457, 13477, 14087, 14207, 16979, 17011, 17033, 17903, 32173, 32203, 32353, 32687, 33589
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jan 23 2021

Keywords

Examples

			a(3) = 97 is an emirp because 97 and 79 are distinct primes. Its sum of digits is 9+7=16, and 97+16 = 113 is an emirp because 113 and 311 are primes.
		

Crossrefs

Cf. A006567. Contains A340843.

Programs

  • Maple
    revdigs:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(10^(i-1)*L[-i],i=1..nops(L))
    end proc:
    isemirp:= proc(n) local r;
    if not isprime(n) then return false fi;
    r:= revdigs(n);
    r <> n and isprime(r)
    end proc:
    filter:= n -> isemirp(n) and isemirp(n +convert(convert(n,base,10),`+`)):
    select(filter, [seq(i,i=3..10^5,2)]);
  • 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): return emirp(n) and emirp(n + sd(n))
    def aupto(nn): return [m for m in range(1, nn+1) if ok(m)]
    print(aupto(18000)) # Michael S. Branicky, Jan 24 2021
Showing 1-1 of 1 results.