Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Numbers Factory by tanya
def checkio(number):
num=number
st=''
while num!=1:
for x in range (9,1,-1):
if num%x==0:
num=num//x
st+=str(x)
break
else:
return 0
return int(st[::-1])
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(8146) == 0, "1st example"
assert checkio(560) == 2578, "1st example"
assert checkio(20) == 45, "1st example"
assert checkio(21) == 37, "2nd example"
assert checkio(17) == 0, "3rd example"
assert checkio(33) == 0, "4th example"
assert checkio(3125) == 55555, "5th example"
assert checkio(9973) == 0, "6th example"
print('Done')
Jan. 22, 2019