Skip to content

Instantly share code, notes, and snippets.

Created January 17, 2016 06:44
Show Gist options
  • Save anonymous/687c4b2021da0dbbff01 to your computer and use it in GitHub Desktop.
Save anonymous/687c4b2021da0dbbff01 to your computer and use it in GitHub Desktop.
shufflemult.py
from itertools import permutations
seen = dict()
i = 0
while True:
current = sorted(set([int("".join(j)) for j in list(permutations(str(i)))]))
if current[-1] not in seen:
for j in current:
seen[j] = True
# print current
answers = dict()
for j in current:
for k in [l for l in current if l > j]:
if j * k not in answers:
answers[j * k] = []
answers[j * k].append(str(j) + " * " + str(k))
for j in answers:
if len(answers[j]) > 1:
print " = ".join(answers[j])
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment