Advertisement
danchaofan

Euler #32

Dec 5th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. def unique(s):
  2.     return len(set(s)) == len(s)
  3.  
  4. answers = []
  5. for a in range(1000000):
  6.     print(a)
  7.     if not unique(str(a)):
  8.         continue
  9.     else:
  10.         for b in range(2, int(a**0.5)+1):
  11.             if a % b == 0:
  12.                 if unique(str(a) + str(b) + str(int(a/b))) and (len(str(a) + str(b) + str(int(a/b))) == 9) and ("0" not in (str(a) + str(b) + str(int(a/b)))):
  13.                     if a not in answers:
  14.                         answers.append(a)
  15. total = 0
  16. for c in answers:
  17.     total += c
  18. print(total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement