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.

A048890 Primes that yield a different prime when rotated by 180 degrees.

This page as a plain text file.
%I A048890 #27 Apr 03 2023 10:36:09
%S A048890 19,61,109,199,601,661,1019,1061,1091,1109,1181,1601,1609,1669,1699,
%T A048890 1811,1901,1999,6011,6091,6101,6199,6619,6661,6689,6691,6899,6991,
%U A048890 10061,10069,10091,10691,10861,10909,11069,11681,11909,16001,16619,16661
%N A048890 Primes that yield a different prime when rotated by 180 degrees.
%C A048890 Also called invertible primes. [_Lekraj Beedassy_, Jan 03 2009]
%H A048890 Reinhard Zumkeller, <a href="/A048890/b048890.txt">Table of n, a(n) for n = 1..1000</a>
%H A048890 C. K. Caldwell, The Prime Glossary, <a href="https://t5k.org/glossary/page.php?sort=Strobogrammatic">strobogrammatic</a> [_Lekraj Beedassy_, Jan 03 2009]
%t A048890 lst = {}; fQ[n_] := Block[{allset = {0, 1, 6, 8, 9}, id = IntegerDigits@n}, rid = Reverse[id /. {6 -> 9, 9 -> 6}]; Union@ Join[id, allset] == allset && PrimeQ@ FromDigits@ rid && rid != id]; Do[ If[ PrimeQ@n && fQ@n, AppendTo[lst, n]], {n, 16900}]; lst (* _Robert G. Wilson v_, Feb 27 2007 *)
%o A048890 (Haskell)
%o A048890 import Data.List (unfoldr)
%o A048890 a048890 n = a048890_list !! (n-1)
%o A048890 a048890_list = filter f a000040_list where
%o A048890    f x = all (`elem` [0,1,6,8,9]) ds && x' /= x && a010051 x' == 1
%o A048890      where x' = foldl c 0 ds
%o A048890            c v 6 = 10*v + 9; c v 9 = 10*v + 6; c v d = 10*v + d
%o A048890            ds = unfoldr d x
%o A048890            d z = if z == 0 then Nothing else Just $ swap $ divMod z 10
%o A048890 -- _Reinhard Zumkeller_, Nov 18 2011
%o A048890 (Python)
%o A048890 from itertools import product
%o A048890 from sympy import isprime
%o A048890 A048890_list = []
%o A048890 for d in product('01689',repeat=6):
%o A048890     s = ''.join(d)
%o A048890     p = int(s)
%o A048890     if p > 0:
%o A048890         q = int(s[::-1].rstrip('0').translate(''.maketrans('69','96')))
%o A048890         if p != q and isprime(q) and isprime(p):
%o A048890             A048890_list.append(p) # _Chai Wah Wu_, Sep 13 2021
%Y A048890 Cf. A007597, A006567, A046732.
%K A048890 base,nonn,easy,nice
%O A048890 1,1
%A A048890 _G. L. Honaker, Jr._
%E A048890 Better definition and more terms from _Robert G. Wilson v_, Feb 27 2007