%I #38 Feb 23 2023 19:20:38
%S 1,2,6,66,858,6006,222222,20522502,244868442,6172882716,231645546132,
%T 49795711759794,2415957997595142,495677121121776594,
%U 22181673755737618122,5521159517777159511255,477552751050050157255774,200345274602020206472543002
%N Smallest palindrome with exactly n distinct prime factors.
%C max{A002110(n), A076886(n), A239696(n)} <= a(n) <= A046399(n).
%C No more terms with less than 17 digits.
%C Next term: 10^16 <= a(13) <= 495677121121776594.
%H Michael S. Branicky, <a href="/A335645/a335645.py.txt">Python program (translation of Suteu's PARI)</a>
%e a(3) = 66 because 66 is the smallest palindromic number with 3 distinct prime factors: 2*3*11.
%o (Python)
%o from sympy import factorint
%o def A335645(n):
%o d = 1
%o while True:
%o half = (d+1)//2
%o for left in range(10**(half-1), 10**half):
%o strleft = str(left)
%o if d%2 == 0:
%o m = int(strleft + strleft[::-1])
%o else:
%o m = int(strleft + (strleft[:-1])[::-1])
%o if len(factorint(m)) == n:
%o return m
%o d += 1
%o print([A335645(n) for n in range(8)]) # _Michael S. Branicky_, Oct 02 2020
%o (PARI)
%o 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)));
%o 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
%Y Subsequence of A002113.
%Y Cf. A002110, A046399, A076886, A239696.
%K nonn,base,hard
%O 0,2
%A _Michael S. Branicky_, Oct 02 2020
%E a(13) from _Michael S. Branicky_ and _David A. Corneth_, Oct 03 2020
%E a(14) from _David A. Corneth_, Oct 03 2020
%E a(15) from _Daniel Suteu_, Feb 05 2023
%E a(16) from _Michael S. Branicky_, Feb 06 2023
%E a(17) from _Michael S. Branicky_, Feb 23 2023
|