login
A347294
Primes that become semiprimes when turned upside down.
1
191, 691, 811, 991, 1009, 1069, 1619, 1801, 1861, 1889, 6089, 6869, 6911, 6961, 8101, 8191, 8609, 8669, 8689, 9001, 9811, 10009, 10099, 10111, 10169, 10181, 10601, 10889, 10891, 11119, 11161, 11689, 11699, 11801, 11969, 11981, 16061, 16691, 16699, 18089, 18119
OFFSET
1,1
LINKS
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