Svoboda | Graniru | BBC Russia | Golosameriki | Facebook
login
A046338
Palindromes > 0 with an even number of prime factors (counted with multiplicity).
3
1, 4, 6, 9, 22, 33, 55, 77, 88, 111, 121, 141, 161, 202, 232, 262, 303, 323, 393, 414, 424, 444, 454, 484, 505, 515, 525, 535, 545, 565, 585, 626, 636, 666, 676, 686, 707, 717, 737, 767, 808, 818, 838, 858, 868, 878, 898, 939, 949, 959, 979, 989, 999, 1111, 1441
OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..17500 (* 10000 terms from John Cerkan *)
MATHEMATICA
Select[Range[1500], PalindromeQ[#]&&EvenQ[PrimeOmega[#]]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 01 2020 *)
PROG
(Python)
from sympy import factorint
from itertools import product
def ispal(n): s = str(n); return s == s[::-1]
def pals(d, base=10): # all d-digit palindromes
digits = "".join(str(i) for i in range(base))
for p in product(digits, repeat=d//2):
if d > 1 and p[0] == "0": continue
left = "".join(p); right = left[::-1]
for mid in [[""], digits][d%2]: yield int(left + mid + right)
def ok(pal): return sum(factorint(pal).values())%2 == 0
print(list(filter(ok, (p for d in range(1, 5) for p in pals(d) if ok(p))))) # Michael S. Branicky, Aug 14 2022
CROSSREFS
Sequence in context: A239307 A137253 A035135 * A118690 A084994 A046328
KEYWORD
nonn,base
AUTHOR
Patrick De Geest, Jun 15 1998
EXTENSIONS
Corrected by Harvey P. Dale, Jan 01 2020
STATUS
approved