Created
December 12, 2011 22:57
-
-
Save jakedobkin/1469544 to your computer and use it in GitHub Desktop.
Euler 52- Permuted Series
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
| # http://projecteuler.net/problem=52 | |
| # we'll use the python built-in permutation function | |
| import itertools | |
| # 166K = 1MM/6, so that's the largest number under 1MM that could have identical # of digits | |
| for k in range (100000,166666): | |
| my_set = set() | |
| perms = itertools.permutations(str(k), len(str(k))) | |
| for i in perms: | |
| number=int("".join(list(i))) | |
| my_set.add(number) | |
| if 2*k in my_set and 3*k in my_set and 4*k in my_set and 5*k in my_set and 6*k in my_set: | |
| print k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment