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.

A347294 Primes that become semiprimes when turned upside down.

This page as a plain text file.
%I A347294 #21 Feb 17 2024 00:46:10
%S A347294 191,691,811,991,1009,1069,1619,1801,1861,1889,6089,6869,6911,6961,
%T A347294 8101,8191,8609,8669,8689,9001,9811,10009,10099,10111,10169,10181,
%U A347294 10601,10889,10891,11119,11161,11689,11699,11801,11969,11981,16061,16691,16699,18089,18119
%N A347294 Primes that become semiprimes when turned upside down.
%H A347294 Michael S. Branicky, <a href="/A347294/b347294.txt">Table of n, a(n) for n = 1..10000</a>
%H A347294 C. K. Caldwell, and G. L. Honaker, Jr., <a href="https://primes.utm.edu/curios/page.php?curio_id=42832">Prime Curio for 191</a>.
%e A347294 811 is a term because when 811 is turned upside down (rotated 180 degrees) it becomes 118=2*59, a semiprime.
%t A347294 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 *)
%o A347294 (Python)
%o A347294 from sympy import isprime, factorint
%o A347294 from itertools import count, islice, product
%o A347294 def f(s): return s[::-1].translate({ord("6"):ord("9"), ord("9"):ord("6")})
%o A347294 def agen():
%o A347294     for digits in count(3):
%o A347294         for first in "1689":
%o A347294             for mid in product("01689", repeat=digits-2):
%o A347294                 for last in "19":
%o A347294                     s = first + "".join(mid) + last
%o A347294                     t = int(s)
%o A347294                     if isprime(t):
%o A347294                         flip = f(s)
%o A347294                         if sum(factorint(int(flip)).values()) == 2:
%o A347294                             yield t
%o A347294 print(list(islice(agen(), 41))) # _Michael S. Branicky_, Feb 16 2024
%Y A347294 Cf. A000040, A001358, A048889.
%K A347294 nonn,base
%O A347294 1,1
%A A347294 _G. L. Honaker, Jr._, Jan 22 2022
%E A347294 More terms from _Amiram Eldar_, Jan 23 2022