A335645 Smallest palindrome with exactly n distinct prime factors.
1, 2, 6, 66, 858, 6006, 222222, 20522502, 244868442, 6172882716, 231645546132, 49795711759794, 2415957997595142, 495677121121776594, 22181673755737618122, 5521159517777159511255, 477552751050050157255774, 200345274602020206472543002
Offset: 0
Examples
a(3) = 66 because 66 is the smallest palindromic number with 3 distinct prime factors: 2*3*11.
Links
- Michael S. Branicky, Python program (translation of Suteu's PARI)
Programs
-
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
-
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
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
Comments