Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Numbers Factory by checinski.szymon
def checkio(number):
#replace this for solution
result = 0
liczby = []
i = 9
while number > 1:
i = 9
while i > 0:
#print (number)
if number % i == 0:
number /= i
liczby.append(i)
break
i -= 1
if i == 1:
#print(liczby)
return 0
liczby.sort()
for l in liczby:
result *= 10
result += l
# print (result)
return result
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"
Nov. 6, 2016