login
A056770
Smallest number that is n times the product of its digits or 0 if impossible.
6
1, 36, 15, 384, 175, 12, 735, 128, 135, 0, 11, 1296, 624, 224, 0, 0, 816, 216, 1197, 0, 315, 132, 115, 0, 0, 0, 2916, 1176, 3915, 0, 93744, 0, 51975, 78962688, 0, 82944, 1184, 0, 0, 0, 31488, 0, 0, 77616, 77175, 4416, 0, 12288, 1715, 0, 612
OFFSET
1,2
LINKS
EXAMPLE
a(4) = 384 because 4*(product of digits of 384) = 4*96 = 384, and no number smaller than 384 has this property.
MATHEMATICA
Do[k = n; If[Mod[n, 10] == 0, Print[0]; Continue[]]; While[Apply[Times, RealDigits[k][[1]]]*n != k, k += n]; Print[k], {n, 1, 14}]
PROG
(Python)
from itertools import count, combinations_with_replacement
from math import prod
def A056770(n):
if not n%10: return 0
for l in count(1):
if 9**l*n < 10**(l-1): return 0
c = 10**l
for d in combinations_with_replacement(range(1, 10), l):
if sorted(str(a:=prod(d)*n)) == list(str(e) for e in d):
c = min(c, a)
if c < 10**l:
return c # Chai Wah Wu, May 09 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Aug 16 2000
EXTENSIONS
a(15) onwards from David W. Wilson, Jan 20 2016
STATUS
approved