1
0
Fork 0
projecteuler/24.py

11 lines
262 B
Python

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)))