A048889 Composite numbers not ending in zero that yield a prime when turned upside down.
68, 116, 118, 161, 166, 169, 188, 608, 616, 1006, 1018, 1066, 1081, 1096, 1106, 1108, 1118, 1169, 1186, 1606, 1618, 1808, 1816, 1898, 1916, 1918, 1969, 1981, 1988, 1996, 6001, 6008, 6016, 6098, 6188, 6191, 6196, 6616, 6668, 6698, 6808, 6809, 6881, 6896
Offset: 1
Examples
68 is not prime, yet when turned upside down gives 89 which is prime.
Links
- Robert Israel and Reinhard Zumkeller, Table of n, a(n) for n = 1..10000 (a(1) to a(1048) from Reinhard Zumkeller)
Programs
-
Haskell
import Data.List (intersect) import Numeric (readInt) import Data.Char (digitToInt) a048889 n = a048889_list !! (n-1) a048889_list = filter f a002808_list where f n = n `mod` 10 > 0 && null ("23547" `intersect` show n) && (a010051 (fst $ head $ readInt 10 (const True) ud $ ns) == 1) where ns = reverse $ show n ud '6' = 9 ud '9' = 6 ud z = digitToInt z -- Reinhard Zumkeller, Aug 11 2011
-
Maple
N:= 1000: # to get a(1) to a(N) count:= 0: for q from 1 while count < N do if q mod 5 <> 0 then L:= convert(q,base,5); m:= nops(L); Lx:= subs(2=6,3=8,4=9,L); x:= add(Lx[i]*10^(i-1),i=1..m); if isprime(x) then next fi; Ly:= subs(2=9,3=8,4=6,L); y:= add(Ly[-i]*10^(i-1),i=1..m); if isprime(y) then count:= count+1; A[count]:= x; fi fi od: seq(A[i],i=1..count); # Robert Israel, Jul 11 2016
-
Mathematica
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 *)
-
Python
from itertools import product from sympy import isprime 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