A198376 Largest n-digit number whose product of digits is n or 0 if no such number exists.
1, 21, 311, 4111, 51111, 611111, 7111111, 81111111, 911111111, 5211111111, 0, 621111111111, 0, 72111111111111, 531111111111111, 8211111111111111, 0, 921111111111111111, 0, 54111111111111111111, 731111111111111111111, 0, 0, 831111111111111111111111
Offset: 1
Examples
113, 131, and 311 are the 3-digit numbers whose product of digits is 3; 311 is the largest.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Table[If[FactorInteger[n][[-1, 1]] > 9, 0, i = (10^n - 1)/9; While[i < 10^n && Times @@ (d = IntegerDigits[i]) != n, i++]; If[i == 10^n, 0, FromDigits[Reverse[d]]]], {n, 30}] (* T. D. Noe, Oct 24 2011 *)
-
Python
def A198376(n): ncopy, p, an = n, 1, "" for d in range(9, 1, -1): while ncopy%d == 0: ncopy//=d; p *= d; an += str(d) if p == n and len(an) <= n: return int(an+'1'*(n-len(an))) return 0 print([A198376(n) for n in range(1, 25)]) # Michael S. Branicky, Jan 21 2021
Formula
a(A068191(n)) = 0 for n >=1.
a(n) <> 0 iff n in { A002473 }. - Michael S. Branicky, Jan 21 2021
Comments