Problem 24

completed December 5, 2011

Comments

It took me a surprisingly long time to realize that the millionth item in a list using Python is referenced with the number 999999, not 1000000 or 1000001. Other than that, Python is great because it already has a permutations function built in! Shortest script ever!

Code

def onenumber(n):
	return ''.join(map(str, n))


from itertools import permutations
all = map(onenumber, permutations(range(10)))

print all[999999]