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.
%I A080788 #20 Nov 19 2021 10:11:09 %S A080788 11,19,61,101,109,181,199,601,619,661,1019,1061,1091,1109,1181,1601, %T A080788 1609,1669,1699,1811,1901,1999,6011,6091,6101,6199,6619,6661,6689, %U A080788 6691,6899,6991,10061,10069,10091,10691,10861,10909,11069,11681,11909,16001,16091 %N A080788 Primes that are still primes when turned upsided down. %D A080788 P. Giannopoulos, The Brainteasers, unpublished. %H A080788 K. D. Bajpai, <a href="/A080788/b080788.txt">Table of n, a(n) for n = 1..11210</a> (First 1000 terms from Reinhard Zumkeller) %o A080788 (Haskell) %o A080788 import Data.List (unfoldr) %o A080788 a048890 n = a048890_list !! (n-1) %o A080788 a048890_list = filter f a000040_list where %o A080788 f x = all (`elem` [0,1,6,8,9]) ds && x' /= x && a010051 x' == 1 %o A080788 where x' = foldl c 0 ds %o A080788 c v 6 = 10*v + 9; c v 9 = 10*v + 6; c v d = 10*v + d %o A080788 ds = unfoldr d x %o A080788 d z = if z == 0 then Nothing else Just $ swap $ divMod z 10 %o A080788 -- _Reinhard Zumkeller_, Nov 18 2011 %o A080788 (Python) %o A080788 from sympy import isprime %o A080788 from itertools import product %o A080788 def ud(s): %o A080788 return s[::-1].translate({ord('6'):ord('9'), ord('9'):ord('6')}) %o A080788 def auptod(maxdigits): %o A080788 alst = [] %o A080788 for d in range(1, maxdigits+1): %o A080788 for p in product("01689", repeat=d-1): %o A080788 if d > 1 and p[0] == "0": continue %o A080788 for end in "19": %o A080788 s = "".join(p) + end %o A080788 t, udt = int(s), int(ud(s)) %o A080788 if isprime(t) and isprime(udt): alst.append(t) %o A080788 return alst %o A080788 print(auptod(5)) # _Michael S. Branicky_, Nov 19 2021 %Y A080788 Cf. A007597, A057770, A080789. %K A080788 base,easy,nonn %O A080788 1,1 %A A080788 P. Giannopoulos (pgiannop1(AT)yahoo.com), Mar 12 2003 %E A080788 Missing 1669 and 6689 inserted by _Reinhard Zumkeller_, Nov 18 2011