Advertisement
benlloydjones

Project Euler 32

Jun 26th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. def PE32():
  2.     horrorShow = []
  3.     for x in range(1, 10, 1):
  4.         for y in range(1000, 10000, 1):
  5.             if "0" not in set(str(x * y) + str(x) + str(y)):
  6.                 if len(set(str(x * y) + str(x) + str(y))) == 9 and len(str(x * y) + str(x) + str(y)) == 9:
  7.                     if x * y not in horrorShow:
  8.                         horrorShow.append(x * y)
  9.     for x in range(10, 100, 1):
  10.         for y in range(100, 1000, 1):
  11.             if "0" not in set(str(x * y) + str(x) + str(y)):
  12.                 if len(set(str(x * y) + str(x) + str(y))) == 9 and len(str(x * y) + str(x) + str(y)) == 9:
  13.                     if x * y not in horrorShow:
  14.                         horrorShow.append(x * y)
  15.     answer = 0
  16.     for x in horrorShow:
  17.         answer += x
  18.     return answer
  19.                    
  20. PE32()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement