login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A119378 Palindromic composites such that some digit permutation is prime. 1
121, 232, 272, 292, 323, 343, 434, 494, 575, 616, 737, 767, 818, 838, 878, 949, 959, 979, 10201, 10801, 10901, 11011, 11611, 11711, 11911, 12121, 12221, 12521, 13031, 13231, 13531, 13631, 14041, 14141, 14641, 14941, 15151, 15251, 15751, 15851, 16261, 16861, 16961 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
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
Sequence in context: A275028 A036309 A346507 * A261618 A084998 A082944
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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 07:11 EDT 2024. Contains 371782 sequences. (Running on oeis4.)