project-euler/052_permuted_multiples.py

24 lines
513 B
Python

#!/usr/bin/env python3
def perm():
#najde najmasno stevilo katerega produkti z 1..6 so permutacije
a=100
b=166
while True:
i=a
while i<=b:
count=1
roll=i*2
while sorted(str(i))==sorted(str(roll)) and count<6:
count+=1
roll+=i
if count==6:
return i
i+=1
a*=10
b=(b*10)+6
return False
if __name__ == '__main__':
print(perm())