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-2 of 2 results.

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

Original entry on oeis.org

1090, 2662, 2992, 3212, 4334, 4994, 5104, 5324, 6776, 7106, 9328, 9548, 10450, 10670, 10780, 11110, 11330, 11440, 11660, 12122, 12452, 12892, 13222, 15004, 16786, 17446, 17666, 29092, 29482, 31912, 36352, 44644, 44834, 45454, 46654, 46664, 47474, 47864, 49094, 49294, 49484, 49684, 49894, 50104
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jun 18 2021

Keywords

Comments

Numbers that are in A345409 in more than one way.
Interchanging an emirp and its reversal is not counted as a different way.

Examples

			a(3) = 2992 is a member because 2992 = 1091 + 1901 = 1181+1811 where 1091 and 1181 and their reversals 1901 and 1811 are primes.
		

Crossrefs

Programs

  • Maple
    revdigs:= proc(n) local L,i; L:= convert(n,base,10); add(L[-i]*10^(i-1),i=1..nops(L)) end proc:
    isemirp1:= proc(n) local r;
    if not isprime(n) then return false fi;
    r:= revdigs(n);
    r > n and isprime(r)
    end proc:
    E:= select(isemirp1, [seq(seq(seq(i*10^d+j,j=1..10^d-1,2),i=[1,3,7,9]),d=1..4)]):
    V:= sort(map(t -> t+revdigs(t),E)):
    M:= select(t -> V[t+1]=V[t], [$1..nops(V)-1]):
    sort(convert(convert(V[M],set),list));
  • Python
    from collections import Counter
    from sympy import isprime, nextprime
    def epgen(start=1, end=float('inf')): # generates unique emirp/prime pairs
        p = nextprime(start-1)
        while p <= end:
            revp = int(str(p)[::-1])
            if p < revp and isprime(revp): yield (p, revp)
            p = nextprime(p)
    def aupto(lim):
        c = Counter(sum(ep) for ep in epgen(1, lim) if sum(ep) <= lim)
        return sorted(s for s in c if c[s] > 1)
    print(aupto(50105)) # Michael S. Branicky, Jun 18 2021

A345410 a(n) is the least number that is the sum of an emirp and its reversal in exactly n ways.

Original entry on oeis.org

44, 1090, 10450, 5104, 88888, 10780, 289982, 299992, 482174, 478874, 868868, 499994, 1073270, 1087790, 1071070, 1069970, 10904990, 10794980, 1091090, 10892990, 1100000, 29955992, 1101100, 26688662, 31022002, 27599572, 46400354, 44688644, 29821792, 45289244, 30122092, 26988962
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jun 18 2021

Keywords

Comments

Interchanging an emirp and its reversal is not counted as a different way.
a(n) is the least number k such that there are exactly n unordered pairs of distinct primes (p,p') such that p' is the digit reversal of p and p+p' = k.
Are terms not divisible by 3? Amiram Eldar finds proof they are; A056964(n) = n + reverse(n) is divisible by 3 if and only if n is divisible by 3. But emirps are primes (other than 3) so they are not divisible by 3. - David A. Corneth, Jun 19 2021

Examples

			a(3) = 10450 because 10450 = 1229+9221 = 1409+9041 = 3407+7043.
		

Crossrefs

Programs

  • Maple
    revdigs:= proc(n) local L,i; L:= convert(n,base,10); add(L[-i]*10^(i-1),i=1..nops(L)) end proc:
    isemirp1:= proc(n) local r;
    if not isprime(n) then return false fi;
    r:= revdigs(n);
    r > n and isprime(r)
    end proc:
    E:= select(isemirp1, [seq(seq(seq(i*10^d+j,j=1..10^d-1,2),i=[1,3,7,9]),d=1..5)]):
    V:= sort(map(t -> t+revdigs(t),E)):
    N:= nops(V):
    W:= Vector(16):
    i:= 1:
    while i < N do
    for j from 1 to N-i while V[i+j]=V[i] do od:
    if j <= 16 and W[j] = 0 then W[j]:= V[i] fi;
      i:= i+j;
    od:
    convert(W,list);
  • Python
    from itertools import product
    from collections import Counter
    from sympy import isprime, nextprime
    def epgen(start=1, end=float('inf')): # generates unique emirp/prime pairs
        digits = 2
        while True:
          for first in "1379":
            for last in "1379":
              if last < first: continue
              for mid in product("0123456789", repeat=digits-2):
                strp = first + "".join(mid) + last
                revstrp = strp[::-1]
                if strp >= revstrp: continue
                p = int(strp)
                if p > end: return
                revp = int(strp[::-1])
                if isprime(p) and isprime(revp): yield (p, revp)
          digits += 1
    def aupto(lim):
        alst = []
        c = Counter(sum(ep) for ep in epgen(1, lim) if sum(ep) <= lim)
        r = set(c.values())
        for i in range(1, max(r)+1):
            if i in r: alst.append(min(s for s in c if c[s] == i))
            else: break
        return alst
    print(aupto(11*10**5)) # Michael S. Branicky, Jun 19 2021

Extensions

More terms from David A. Corneth, Jun 18 2021
Showing 1-2 of 2 results.