A046351 Palindromic composite numbers with only palindromic prime factors.
4, 6, 8, 9, 22, 33, 44, 55, 66, 77, 88, 99, 121, 202, 242, 252, 262, 303, 343, 363, 393, 404, 484, 505, 525, 606, 616, 626, 686, 707, 808, 909, 939, 1111, 1331, 1441, 1661, 1991, 2112, 2222, 2662, 2772, 2882, 3333, 3443, 3773, 3883, 3993, 4224, 4444, 5445
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
palQ[n_]:=Reverse[x=IntegerDigits[n]]==x; Select[Range[4,5500],!PrimeQ[#]&&And@@palQ/@Join[{#},First/@FactorInteger[#]]&](* Jayanta Basu, Jun 05 2013 *)
-
Python
from itertools import product from sympy import isprime, primefactors as pf def pal(n): s = str(n); return s == s[::-1] def palsthru(maxdigits): midrange = [[""], [str(i) for i in range(10)]] for digits in range(1, maxdigits+1): for p in product("0123456789", repeat=digits//2): left = "".join(p) if len(left) and left[0] == '0': continue for middle in midrange[digits%2]: yield int(left+middle+left[::-1]) def okpal(p): return p > 3 and not isprime(p) and all(pal(f) for f in pf(p)) print(list(filter(okpal, palsthru(4)))) # Michael S. Branicky, Apr 06 2021