login
A246757
Largest n-digit number divisible by the product of its decimal digits.
1
9, 36, 816, 9612, 93744, 973728, 9939915, 99221112, 997711344, 9993393711, 99934212672, 999641938176, 9999121936392, 99996414731136, 999994123418112, 9999982411646976, 99999318116613312, 999991631331122112, 9999944111773994112, 99999911232931433472, 999999832211912282112
OFFSET
1,1
COMMENTS
The smallest such numbers are given by repunits A000042 or A002275.
LINKS
PROG
(PARI) { A246757(n) = my(m, d, p, q); m=n\2; forstep(k=10^m-1, (10^m-1)/9, -1, d=digits(k); q=prod(i=1, #d, d[i]); if(q==0, next); forstep(s=(((k+1)*10^(n-m))\q)*q, k*10^(n-m), -q, d=digits(s); p=prod(i=1, #d, d[i]); if(p==0 || s%p, next); return(s) )) }
(Python)
from operator import mul
from functools import reduce
def A246757(n):
for i in range(10**n-1, int('1'*n)-1, -1):
pd = reduce(mul, (int(d) for d in str(i)))
if pd and not i % pd:
return i # Chai Wah Wu, Sep 08 2014
CROSSREFS
Subsequence of A007602.
Sequence in context: A223306 A272890 A129425 * A079655 A203764 A053949
KEYWORD
nonn,base
AUTHOR
Max Alekseyev, Sep 02 2014
STATUS
approved