OFFSET
1,1
COMMENTS
a(33) = 7352537 is the smallest palindromic prime using all prime digits (see Prime Curios! link). - Bernard Schott, Nov 10 2020
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..12725 (all terms with <= 17 digits; terms 1..330 from Harvey P. Dale)
Chris K. Caldwell and G. L. Honaker, Jr., 7352537, Prime Curios!
MATHEMATICA
Select[ Range[ 1, 10^7 ], PrimeQ[ # ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 0 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 1 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 4 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 6 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 8 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 9 ] && RealDigits[ # ][ [ 1 ] ] == Reverse[ RealDigits[ # ][ [ 1 ] ] ] & ]
Table[FromDigits/@Select[Tuples[{2, 3, 5, 7}, n], #==Reverse[#]&&PrimeQ[ FromDigits[ #]]&], {n, 12}]//Flatten (* Harvey P. Dale, Jun 19 2016 *)
f@n_ := Prime@n;
g@l_ := FromDigits@# & /@ Table[Join[l, {f@i}, Reverse@l], {i, 4}];
Flatten[g@# & /@ (f@# & /@
Select[Table[IntegerDigits[n, 5], {n, 2000}], FreeQ[#, 0] &])] //
Select[PrimeQ] (* Hans Rudolf Widmer, Dec 18 2021 *)
PROG
(Python)
from sympy import isprime
from itertools import count, product, takewhile
def primedigpals():
for d in count(1, 2):
for p in product("2357", repeat=d//2):
left = "".join(p)
for mid in "2357":
yield int(left + mid + left[::-1])
def aupto(N):
return list(takewhile(lambda x: x<=N, filter(isprime, primedigpals())))
print(aupto(10**7)) # Michael S. Branicky, Dec 18 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Aug 18 2000
STATUS
approved