OFFSET
0,2
COMMENTS
LINKS
Giovanni Resta, Harshad numbers.
Eric Weisstein's World of Mathematics, Distinct Prime Factors.
EXAMPLE
2310 = 2*3*5*7*11 is the smallest integer with 5 prime factors because it is a primorial number, as 2310 / (2+3+1+0) = 385, 2310 is a Niven number: a(5) = 2310.
PROG
(PARI) a(n) = my(k=1); while ((k % sumdigits(k)) || (omega(k) != n), k++); k; \\ Michel Marcus, Jan 20 2023
(PARI)
omega_niven(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, r=nextprime(q+1)); while(v <= B, if(j==1, if(v>=A && v%sumdigits(v) == 0, listput(list, v)), if(v*r <= B, list=concat(list, f(v, r, 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_niven(x, y, n)); if(#v >= 1, return(v[1])); x=y+1; y=2*x); \\ Daniel Suteu, Jan 22 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Jan 20 2023
EXTENSIONS
a(8)-a(9) from Michel Marcus, Jan 20 2023
a(10)-a(19) from Daniel Suteu, Jan 22 2023
STATUS
approved