OFFSET
1,1
REFERENCES
P. Giannopoulos, The Brainteasers, unpublished.
LINKS
K. D. Bajpai, Table of n, a(n) for n = 1..11210 (First 1000 terms from Reinhard Zumkeller)
PROG
(Haskell)
import Data.List (unfoldr)
a048890 n = a048890_list !! (n-1)
a048890_list = filter f a000040_list where
f x = all (`elem` [0, 1, 6, 8, 9]) ds && x' /= x && a010051 x' == 1
where x' = foldl c 0 ds
c v 6 = 10*v + 9; c v 9 = 10*v + 6; c v d = 10*v + d
ds = unfoldr d x
d z = if z == 0 then Nothing else Just $ swap $ divMod z 10
-- Reinhard Zumkeller, Nov 18 2011
(Python)
from sympy import isprime
from itertools import product
def ud(s):
return s[::-1].translate({ord('6'):ord('9'), ord('9'):ord('6')})
def auptod(maxdigits):
alst = []
for d in range(1, maxdigits+1):
for p in product("01689", repeat=d-1):
if d > 1 and p[0] == "0": continue
for end in "19":
s = "".join(p) + end
t, udt = int(s), int(ud(s))
if isprime(t) and isprime(udt): alst.append(t)
return alst
print(auptod(5)) # Michael S. Branicky, Nov 19 2021
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
P. Giannopoulos (pgiannop1(AT)yahoo.com), Mar 12 2003
EXTENSIONS
Missing 1669 and 6689 inserted by Reinhard Zumkeller, Nov 18 2011
STATUS
approved