Created
April 25, 2011 19:57
-
-
Save mindjiver/941089 to your computer and use it in GitHub Desktop.
Euler - Problem 24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# the number of permutations of a n length list is n! | |
from itertools import permutations, islice | |
# recipe from itertools library documentation. | |
def take(n, iterable): | |
"Return first n items of the iterable as a list" | |
return list(islice(iterable, n)) | |
l = range(0, 10) | |
n = 1000000 | |
print take(n, permutations(l))[-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment