A048660 Erroneous version of A134997.
1, 1, 2, 2, 1, 14, 40, 52, 228, 482
Offset: 1
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.
120121 is such a number because 120121, 121021 (upside down), 151051 (mirror) and 150151 are all prime. (This is the smallest one in which all four numbers are distinct.)
lst1={2,5}; startQ[n_]:=First[IntegerDigits[n]]==1; subQ[n_]:=Module[{lst={0,1,2,5,8}},SubsetQ[lst,Union[IntegerDigits[n]]]]; rev[n_]:=Reverse[IntegerDigits[n]]; updown[n_]:=FromDigits[rev[n]]; mirror[n_]:=FromDigits[rev[n]/.{2-> 5,5-> 2}]; updownmirror[n_]:=FromDigits[rev[mirror[n]]]; lst2=Select[Range@188801,And[startQ[#],subQ[#],PrimeQ[#],PrimeQ[updown[#]],PrimeQ[mirror[#]],PrimeQ[updownmirror[#]]]&]; Join[lst1,lst2] (* Ivan N. Ianakiev, Oct 08 2015 *)
from sympy import isprime from itertools import count, islice, product def t(s): return s.translate({ord("2"):ord("5"), ord("5"):ord("2")}) def ok(s): # s is a string of digits return all(isprime(int(w)) for w in [s, s[::-1], t(s), t(s[::-1])]) def agen(): # generator of terms yield from (2, 5) for d in count(2): for mid in product("01258", repeat=d-2): s = "1" + "".join(mid) + "1" if ok(s): yield int(s) print(list(islice(agen(), 35))) # Michael S. Branicky, Apr 27 2024
Comments