Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Numbers Factory by tokiojapan55
import math
def checkio(number):
ans,queue = 0,[[n,number//n] for n in range(2,10) if number%n==0]
while queue:
path = queue.pop()
if max(path)<10:
ans = min(sum([n*10**i for i,n in enumerate(path)]), ans if ans else math.inf)
else:
for n in range(2,10):
if path[-1]%n==0:
queue.append(path[:-1]+[n,path[-1]//n])
return ans
June 18, 2020
Comments: