Project Euler # 24 Lexicographic permutations in Python
You’re building up a huge list of permutations in order to get to exactly one permutation. This is needlessly using time (computing all permutations that come before it) and memory (storing all those permutations in a list.  

If you have 9 objects, you can have 9! = 3,628,800 permutations.  So with the 10 digits, 0 through 9, the first 362,880 permutations will be 0#########, the next 362,880 permutations will be 1#########, and you’ll reach the millionth permutation 274,240 permutations in to the 2#########’s.  So, 1 digit down, 9 to go. 

With 8 objects, you can have 8! = 40,320 permutations.  Again, you can determine you’ll cross the 274,240’th permutation during the 7th group of permutations of the 9 objects: 013456789 ... so the your millionth permutation will be of the form 27########. 

Repeat for the rest of the digits: a calculator works fine.   Or write a program to solve this, and the answer will be returned directly in a fraction of a second.