OFFSET
0,2
COMMENTS
LINKS
Michael S. Branicky, Python program (translation of Suteu's PARI)
EXAMPLE
a(3) = 66 because 66 is the smallest palindromic number with 3 distinct prime factors: 2*3*11.
PROG
(Python)
from sympy import factorint
def A335645(n):
d = 1
while True:
half = (d+1)//2
for left in range(10**(half-1), 10**half):
strleft = str(left)
if d%2 == 0:
m = int(strleft + strleft[::-1])
else:
m = int(strleft + (strleft[:-1])[::-1])
if len(factorint(m)) == n:
return m
d += 1
print([A335645(n) for n in range(8)]) # Michael S. Branicky, Oct 02 2020
(PARI)
omega_palindromes(A, B, n) = A=max(A, vecprod(primes(n))); (f(m, p, j) = my(list=List()); forprime(q=p, sqrtnint(B\m, j), my(v=m*q); if(q == 5 && v%2 == 0, next); while(v <= B, if(j==1, if(v>=A && fromdigits(Vecrev(digits(v))) == v, listput(list, v)), if(v*(q+1) <= B, list=concat(list, f(v, q+1, j-1)))); v *= q)); list); vecsort(Vec(f(1, 2, n)));
a(n) = if(n==0, return(1)); my(x=vecprod(primes(n)), y=2*x); while(1, my(v=omega_palindromes(x, y, n)); if(#v >= 1, return(v[1])); x=y+1; y=2*x); \\ Daniel Suteu, Feb 05 2023
CROSSREFS
KEYWORD
nonn,base,hard
AUTHOR
Michael S. Branicky, Oct 02 2020
EXTENSIONS
a(13) from Michael S. Branicky and David A. Corneth, Oct 03 2020
a(14) from David A. Corneth, Oct 03 2020
a(15) from Daniel Suteu, Feb 05 2023
a(16) from Michael S. Branicky, Feb 06 2023
a(17) from Michael S. Branicky, Feb 23 2023
STATUS
approved