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.

A345408 Numbers that are the sum of an emirp and its reversal in more than one way.

This page as a plain text file.
%I A345408 #11 Jun 18 2021 20:43:32
%S A345408 1090,2662,2992,3212,4334,4994,5104,5324,6776,7106,9328,9548,10450,
%T A345408 10670,10780,11110,11330,11440,11660,12122,12452,12892,13222,15004,
%U A345408 16786,17446,17666,29092,29482,31912,36352,44644,44834,45454,46654,46664,47474,47864,49094,49294,49484,49684,49894,50104
%N A345408 Numbers that are the sum of an emirp and its reversal in more than one way.
%C A345408 Numbers that are in A345409 in more than one way.
%C A345408 Interchanging an emirp and its reversal is not counted as a different way.
%H A345408 Robert Israel, <a href="/A345408/b345408.txt">Table of n, a(n) for n = 1..10000</a>
%e A345408 a(3) = 2992 is a member because 2992 = 1091 + 1901 = 1181+1811 where 1091 and 1181 and their reversals 1901 and 1811 are primes.
%p A345408 revdigs:= proc(n) local L,i; L:= convert(n,base,10); add(L[-i]*10^(i-1),i=1..nops(L)) end proc:
%p A345408 isemirp1:= proc(n) local r;
%p A345408 if not isprime(n) then return false fi;
%p A345408 r:= revdigs(n);
%p A345408 r > n and isprime(r)
%p A345408 end proc:
%p A345408 E:= select(isemirp1, [seq(seq(seq(i*10^d+j,j=1..10^d-1,2),i=[1,3,7,9]),d=1..4)]):
%p A345408 V:= sort(map(t -> t+revdigs(t),E)):
%p A345408 M:= select(t -> V[t+1]=V[t], [$1..nops(V)-1]):
%p A345408 sort(convert(convert(V[M],set),list));
%o A345408 (Python)
%o A345408 from collections import Counter
%o A345408 from sympy import isprime, nextprime
%o A345408 def epgen(start=1, end=float('inf')): # generates unique emirp/prime pairs
%o A345408     p = nextprime(start-1)
%o A345408     while p <= end:
%o A345408         revp = int(str(p)[::-1])
%o A345408         if p < revp and isprime(revp): yield (p, revp)
%o A345408         p = nextprime(p)
%o A345408 def aupto(lim):
%o A345408     c = Counter(sum(ep) for ep in epgen(1, lim) if sum(ep) <= lim)
%o A345408     return sorted(s for s in c if c[s] > 1)
%o A345408 print(aupto(50105)) # _Michael S. Branicky_, Jun 18 2021
%Y A345408 Cf. A006567, A345409.
%K A345408 nonn,base
%O A345408 1,1
%A A345408 _J. M. Bergot_ and _Robert Israel_, Jun 18 2021