Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Fast solution in Speedy category for Numbers Factory by Sim0000
def checkio(number):
result = []
for d in range(9,1,-1):
while number % d == 0:
number //= d
result.append(d)
if number != 1: return 0
return int(''.join(map(str, result[::-1])))
# The case input is maximum : checkio(99225) = 557799
# The case output is maximum : checkio(93750) = 5555556
# The minimum case checkio(10) = 25
# Only 684 non-zero answers exists in range(10,100000)
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"
April 4, 2014
Comments: