login
A346756
Lesser emirps (A109308) subtracted from their reversals.
1
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,1
LINKS
Carlos Rivera, Puzzle 20. Reversible Primes, The Prime Puzzles and Problems Connection.
FORMULA
a(n) = reverse(A109308(n)) - A109308(n).
EXAMPLE
31 - 13 = 18, 71 - 17 = 54, 73 - 37 = 36 (distance between lesser emirps and their reversals).
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base,look
AUTHOR
George Bull, Aug 20 2021
EXTENSIONS
Better name and more terms from Jon E. Schoenfield, Aug 20 2021
STATUS
approved