This time lets take it to pure mathematics, permutations. Permutation is an ordered arrangement of objects, for example, alphabets, numerical, words. In this session, I am dealing with the lexicographic order of listed numerical digits, problem from projecteuler. The problem requires the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9, which took me two days to work on. Coming up with the solution was not that difficult, only that the function took along run time hence not efficient. The challenge was to develop a function that takes a short run time as possible, this is, less than 5 second.
Simpler solution, but takes along runtime.
d = range(0,N)
c = b *factorial(l) #Product for 10^6 summation
if currentTarget-c>=0 and currentTarget-cNext<0: