1
0
Fork 0
projecteuler/24.py

11 lines
262 B
Python
Raw Normal View History

2016-11-29 23:38:07 +00:00
import math
permutation = []
digits = range(0, 10)
position = 999999
while (len(digits)):
width = math.factorial(len(digits) - 1)
permutation.append(digits.pop(position / width))
position %= width
print int(''.join(map(str, permutation)))