OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
C. K. Caldwell, and G. L. Honaker, Jr., Prime Curio for 191.
EXAMPLE
811 is a term because when 811 is turned upside down (rotated 180 degrees) it becomes 118=2*59, a semiprime.
MATHEMATICA
semiQ[n_] := PrimeOmega[n] == 2; q[n_] := PrimeQ[n] && Module[{d = IntegerDigits[n]}, AllTrue[d, MemberQ[{0, 1, 6, 8, 9}, #] &] && semiQ[FromDigits[Reverse[d] /. {6 -> 9, 9 -> 6}]]]; Select[Range[20000], q] (* Amiram Eldar, Jan 23 2022 *)
PROG
(Python)
from sympy import isprime, factorint
from itertools import count, islice, product
def f(s): return s[::-1].translate({ord("6"):ord("9"), ord("9"):ord("6")})
def agen():
for digits in count(3):
for first in "1689":
for mid in product("01689", repeat=digits-2):
for last in "19":
s = first + "".join(mid) + last
t = int(s)
if isprime(t):
flip = f(s)
if sum(factorint(int(flip)).values()) == 2:
yield t
print(list(islice(agen(), 41))) # Michael S. Branicky, Feb 16 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
G. L. Honaker, Jr., Jan 22 2022
EXTENSIONS
More terms from Amiram Eldar, Jan 23 2022
STATUS
approved