OFFSET
1,1
LINKS
Robert Israel and Reinhard Zumkeller, Table of n, a(n) for n = 1..10000 (a(1) to a(1048) from Reinhard Zumkeller)
EXAMPLE
68 is not prime, yet when turned upside down gives 89 which is prime.
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 *)
PROG
(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
(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
CROSSREFS
KEYWORD
base,easy,nonn,nice
AUTHOR
STATUS
approved