Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Numbers Factory by jacekgrycza
def checkio(number):
P=[2,3,5,7,11]
D=[]
while(number!=1):
for k in range(0, len(P)):
if(P[k]>7):
return 0
if number%P[k]==0:
D.append(P[k])
number=number/(P[k])
break
while(D.count(2)>=3):
D.remove(2)
D.remove(2)
D.remove(2)
D.append (8)
while(D.count(3)>=2):
D.remove(3)
D.remove(3)
D.append (9)
while(2 in D and 3 in D):
D.remove(2)
D.remove(3)
D.append (6)
while(D.count(2)>=2):
D.append(4)
D.remove(2)
D.remove(2)
D.sort()
t=0
x=1
for i in D[::-1]:
t=t+x*i
x=x*10
return t
Oct. 27, 2016