login
Smallest number m such that m and reverse(m) each have exactly n distinct prime factors.
2

%I #26 Feb 17 2024 00:51:01

%S 2,6,66,858,6006,204204,10444434,208888680,6172882716,231645546132,

%T 49795711759794,2400532020354468,477566276048801940,

%U 24333607174192936620

%N Smallest number m such that m and reverse(m) each have exactly n distinct prime factors.

%C a(15) > 10^21. - _Max Alekseyev_, Feb 16 2024

%e The first nontrivial example is a(6) = 204204. 204204 = 2^2*3*7*11*13*17 (6 distinct prime factors). 402402 = 2*3*7*11*13*67 (6 distinct prime factors). Since 204204 is the smallest number with this property, a(6) = 204204.

%o (Python)

%o import sympy

%o from sympy import factorint

%o def Rev(x):

%o ..rev = ''

%o ..for i in str(x):

%o ....rev = i + rev

%o ..return int(rev)

%o def RevFact(x):

%o ..n = 2

%o ..while n < 10**8:

%o ....if len(list(factorint(n).values())) == x:

%o ......if len(list(factorint(Rev(n)).values())) == x:

%o ........return n

%o ......else:

%o ........n += 1

%o ....else:

%o ......n += 1

%o x = 1

%o while x < 50:

%o ..print(RevFact(x))

%o ..x += 1

%o (PARI)

%o generate(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); while(v <= B, if(j==1, if(v>=A && omega(fromdigits(Vecrev(digits(v)))) == n, 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) = my(x=vecprod(primes(n)), y=2*x); while(1, my(v=generate(x, y, n)); if(#v >= 1, return(v[1])); x=y+1; y=2*x); \\ _Daniel Suteu_, Feb 07 2023

%Y Cf. A046399, A113548.

%K nonn,base,more

%O 1,1

%A _Derek Orr_, Mar 24 2014

%E a(8)-a(9) from _Giovanni Resta_, Mar 28 2014

%E a(10)-a(12) from _Daniel Suteu_, Feb 07 2023

%E a(13) from _Michael S. Branicky_, Feb 14 2023

%E a(14) from _Max Alekseyev_, Feb 15 2024