OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
555 = 3*5*37, 595 = 5*7*17 and 777 = 3*7*37 are palindromic, odd, composite and products of an odd number of distinct primes.
50505 = 3 * 5 * 7 * 13 * 37 is the first term with five factors.
125 = 5^3 and 5445 = 3^2 * 5 * 11^2 are not terms since they are not the products of distinct primes.
MAPLE
test := proc(n) local d; d := convert(n, base, 10); return ListTools[Reverse](d)=d and numtheory[mobius](n)=-1 and not isprime(n); end; a := []; for n from 1 to 30000 by 2 do if test(n) then a := [op(a), n]; end; od; a;
MATHEMATICA
Select[Range[2, 20000], ! PrimeQ[#] && OddQ[#] && PalindromeQ[#] &&
OddQ[Length[Transpose[FactorInteger[#]][[2]]]] &&
Max[Transpose[FactorInteger[#]][[2]]] == 1 &] (* Tanya Khovanova, Aug 26 2022 *)
PROG
(Python)
from sympy import isprime, factorint
from itertools import count, islice, product
def cond(n):
if n%2 == 0 or isprime(n): return False
f = factorint(n)
return len(f) == sum(f.values()) and len(f)&1
def oddpals(): # generator of odd palindromes
yield from [1, 3, 5, 7, 9]
for d in count(2):
for first in "13579":
for p in product("0123456789", repeat=(d-2)//2):
left = "".join(p); right = left[::-1]
for mid in [[""], "0123456789"][d%2]:
yield int(first + left + mid + right + first)
def agen(): yield from filter(cond, oddpals())
print(list(islice(agen(), 38))) # Michael S. Branicky, Aug 25 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jani Melik, Oct 13 2002
EXTENSIONS
Edited by Dean Hickerson, Oct 21 2002
Name edited by Tanya Khovanova, Aug 26 2022
STATUS
approved