Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Basic numeral operations solution in Clear category for Numbers Factory by Sebastian.M
def checkio(number):
nums = []
while number > 9:
found = False
for x in range(9, 1, -1):
if number % x == 0:
found = True
nums.append(x)
number = number//x
break
if not found:
return 0
nums.append(number)
outcome = ""
nums.sort()
for num in nums:
outcome += str(num)
return int(outcome)
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. 5, 2016