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.

A048889 Composite numbers not ending in zero that yield a prime when turned upside down.

This page as a plain text file.
%I A048889 #21 Dec 26 2022 15:08:52
%S A048889 68,116,118,161,166,169,188,608,616,1006,1018,1066,1081,1096,1106,
%T A048889 1108,1118,1169,1186,1606,1618,1808,1816,1898,1916,1918,1969,1981,
%U A048889 1988,1996,6001,6008,6016,6098,6188,6191,6196,6616,6668,6698,6808,6809,6881,6896
%N A048889 Composite numbers not ending in zero that yield a prime when turned upside down.
%H A048889 Robert Israel and Reinhard Zumkeller, <a href="/A048889/b048889.txt">Table of n, a(n) for n = 1..10000</a> (a(1) to a(1048) from Reinhard Zumkeller)
%e A048889 68 is not prime, yet when turned upside down gives 89 which is prime.
%p A048889 N:= 1000: # to get a(1) to a(N)
%p A048889 count:= 0:
%p A048889 for q from 1 while count < N do
%p A048889   if q mod 5 <> 0 then
%p A048889     L:= convert(q,base,5);
%p A048889     m:= nops(L);
%p A048889     Lx:= subs(2=6,3=8,4=9,L);
%p A048889     x:= add(Lx[i]*10^(i-1),i=1..m);
%p A048889     if isprime(x) then next fi;
%p A048889     Ly:= subs(2=9,3=8,4=6,L);
%p A048889     y:= add(Ly[-i]*10^(i-1),i=1..m);
%p A048889     if isprime(y) then
%p A048889       count:= count+1;
%p A048889       A[count]:= x;
%p A048889     fi
%p A048889 fi
%p A048889 od:
%p A048889 seq(A[i],i=1..count); # _Robert Israel_, Jul 11 2016
%t A048889 Select[Range[7000],CompositeQ[#]&&Mod[#,10]!=0&&SubsetQ[{0,1,6,8,9}, IntegerDigits[ #]]&&PrimeQ[FromDigits[Reverse[IntegerDigits[#]]/.{6->9,9->6}]]&] (* _Harvey P. Dale_, Dec 26 2022 *)
%o A048889 (Haskell)
%o A048889 import Data.List (intersect)
%o A048889 import Numeric (readInt)
%o A048889 import Data.Char (digitToInt)
%o A048889 a048889 n = a048889_list !! (n-1)
%o A048889 a048889_list = filter f a002808_list where
%o A048889    f n = n `mod` 10 > 0 &&
%o A048889          null ("23547" `intersect` show n)  &&
%o A048889          (a010051 (fst $ head $ readInt 10 (const True) ud $ ns) == 1)
%o A048889        where ns = reverse $ show n
%o A048889              ud '6' = 9
%o A048889              ud '9' = 6
%o A048889              ud z = digitToInt z
%o A048889 -- _Reinhard Zumkeller_, Aug 11 2011
%o A048889 (Python)
%o A048889 from itertools import product
%o A048889 from sympy import isprime
%o A048889 A048889_list = [m for m in (int(''.join(d)) for d in product('01689',repeat=6)) if m % 10 and not isprime(m) and isprime(int(str(m)[::-1].translate(''.maketrans('69','96'))))] # _Chai Wah Wu_, Sep 14 2021
%Y A048889 Cf. A002808, A010051.
%K A048889 base,easy,nonn,nice
%O A048889 1,1
%A A048889 _G. L. Honaker, Jr._