OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
121 is composite that have a prime digit permutation: 211.
1001 is composite, but is not a term since 0011, though prime, contains leading zeros, which is not allowed here.
MATHEMATICA
palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse@idn]; fQ[n_] := Union[PrimeQ /@ FromDigits /@ Permutations@ IntegerDigits@n][[ -1]] == True; Select[Range@15850, !PrimeQ@# && palQ[ #, 10] && fQ@# &] (* Robert G. Wilson v, Aug 04 2006 *)
PROG
(Python)
from sympy import isprime
from itertools import count, islice, product
from sympy.utilities.iterables import multiset_permutations as mp
def pals(base=10): # generator for all palindromes as strings
digits = "".join(str(i) for i in range(base))
for d in count(1):
for p in product(digits, repeat=d//2):
if d//2 > 0 and p[0] == "0": continue
left = "".join(p); right = left[::-1]
for mid in [[""], digits][d%2]: yield left + mid + right
def ok(s): # where s is string of digits
if isprime(int(s)): return False
return any(p[0]!="0" and isprime(int("".join(p))) for p in mp(s))
def agen():
yield from (int(s) for s in pals() if ok(s))
print(list(islice(agen(), 43))) # Michael S. Branicky, Nov 27 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Tanya Khovanova, Jul 24 2006
EXTENSIONS
More terms from Joshua Zucker and Robert G. Wilson v, Aug 04 2006
a(41) and beyond from Michael S. Branicky, Nov 27 2022
STATUS
approved