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.

A346756 Lesser emirps (A109308) subtracted from their reversals.

Original entry on oeis.org

18, 54, 36, 18, 594, 198, 792, 594, 594, 792, 792, 396, 396, 594, 594, 198, 198, 198, 7992, 180, 270, 2268, 540, 8532, 810, 6804, 1908, 7902, 360, 2358, 630, 2718, 1908, 5904, 1998, 7992, 90, 6084, 8172, 8262, 8442, 2538, 450, 8532, 7632, 7812, 7902, 2088, 270
Offset: 1

Views

Author

George Bull, Aug 20 2021

Keywords

Examples

			31 - 13 = 18, 71 - 17 = 54, 73 - 37 = 36 (distance between lesser emirps and their reversals).
		

Crossrefs

Programs

  • Maple
    rev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L));
    end proc:
    f:= proc(p) local r;
      if not isprime(p) then return NULL fi;
      r:= rev(p);
      if r > p and isprime(r) then r-p else NULL fi
    end proc:
    map(f, [seq(i,i=11 .. 10^4, 2)]); # Robert Israel, Dec 28 2023
  • Mathematica
    f[n_] := IntegerReverse[n] - n; Map[f, Select[Range[1500], f[#] > 0 && PrimeQ[#] && PrimeQ @ IntegerReverse[#] &]] (* Amiram Eldar, Sep 08 2021 *)
  • PARI
    rev(p) = fromdigits(Vecrev(digits(p))); \\ A004086
    lista(nn) = {my(list = List()); forprime (p=1, nn, my(q=rev(p)); if ((q>p) && isprime(q), listput(list, q-p));); Vec(list);} \\ Michel Marcus, Sep 07 2021
    
  • Python
    from sympy import isprime, nextprime
    def aupton(terms):
        alst, p = [], 2
        while len(alst) < terms:
            revp = int(str(p)[::-1])
            if p < revp and isprime(revp):
                alst.append(revp - p)
            p = nextprime(p)
        return alst
    print(aupton(49)) # Michael S. Branicky, Sep 08 2021

Formula

a(n) = reverse(A109308(n)) - A109308(n).

Extensions

Better name and more terms from Jon E. Schoenfield, Aug 20 2021