Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Tragiczne, długie, ale w końcu nie ma błędu. solution in Clear category for Numbers Factory by Johny9700
def checkio(number):
n=number
new=[]
while n>1:
if n%9==0:
new.append(9)
n/=9
elif n%8==0:
new.append(8)
n/=8
elif n%7==0:
new.append(7)
n/=7
elif n%6==0:
new.append(6)
n/=6
elif n%5==0:
new.append(5)
n/=5
elif n%4==0:
new.append(4)
n/=4
elif n%3==0:
new.append(3)
n/=3
elif n%2==0:
new.append(2)
n/=2
else:
return 0
res=""
for i in sorted(new):
res+=str(i)
return int(res)
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. 21, 2016