Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Numbers Factory by rhyparo
def checkio(number):
d=[]
while number!=1:
div=[x for x in range(9, 1, -1) if number%x==0]
if not div: return 0
d.append(div[0])
number/=div[0]
d.sort()
return int(''.join(str(x) for x in d))
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
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"
assert checkio(1536) == 3888, "7th example"
March 1, 2015
Comments: