Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Numbers Factory by m.dziardziel
def checkio(number):
lista=[]
a=2
while number!=1:
if number%a==0:
lista.append(a)
number=number/a
else:
a=a+1
tex=""
licz=1
print(lista)
for a in range(0,len(lista)):
if licz*lista[a]<10:
licz=licz*lista[a]
else:
if licz>=10:
return 0
tex=tex+str(licz)
licz=1
licz=licz*lista[a]
if licz>=10:
return 0
tex=tex+str(licz)
tab=[]
for a in tex:
tab.append(a)
tab.sort()
tex=""
for a in tab:
tex=tex+str(a)
zm=tex
tex=""
licz=1
for a in range(len(lista)-1,-1,-1):
if licz*lista[a]<10:
licz=licz*lista[a]
else:
if licz>=10:
return 0
tex=tex+str(licz)
licz=1
licz=licz*lista[a]
if licz>=10:
return 0
tex=tex+str(licz)
tab=[]
for a in tex:
tab.append(a)
tab.sort()
tex=""
for a in tab:
tex=tex+str(a)
if int(tex)>int(zm):
return int(zm)
return int(tex)
Nov. 16, 2016