Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Numbers Factory solution in Clear category for Numbers Factory by michal_bien
def checkio(number):
multiplifiers = [2,3,5,7]
res = []
while number>1:
prime=True
for m in multiplifiers:
if number%m==0:
number=number/m
res.append(m)
prime=False
if prime: return 0
while True:
if res.count(3)>1:
res[res.index(3)]=9
res.remove(3)
continue
if res.count(2)>2:
res[res.index(2)]=8
res.remove(2)
res.remove(2)
continue
elif res.count(3)>0 and res.count(2)>0:
res[res.index(3)]=6
res.remove(2)
continue
elif res.count(2)>1:
res[res.index(2)]=4
res.remove(2)
continue
break
res.sort()
sres = ""
for n in res:
sres+=str(n)
return int(sres)
Oct. 8, 2016