Skip to content

Instantly share code, notes, and snippets.

@jakedobkin
Created December 12, 2011 22:57
Show Gist options
  • Select an option

  • Save jakedobkin/1469544 to your computer and use it in GitHub Desktop.

Select an option

Save jakedobkin/1469544 to your computer and use it in GitHub Desktop.
Euler 52- Permuted Series
# 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