Skip to content

Instantly share code, notes, and snippets.

@ayushgoel
Last active August 29, 2015 14:08
Show Gist options
  • Save ayushgoel/0c201ecd03ee6df9c37d to your computer and use it in GitHub Desktop.
Save ayushgoel/0c201ecd03ee6df9c37d to your computer and use it in GitHub Desktop.
Project Euler 52
def digits(x):
return set([int(j) for j in str(x)])
x = 1000
while True:
#write code
y = int(1.668*x)
for i in range(x, y):
print i
digitsOfNumber = digits(i)
if (sum(digitsOfNumber) % 3) == 0 :
allNums = [digits(i*j) for j in range(1,7)]
isEqual = True
for j in range((len(allNums) - 1)):
if allNums[j] != allNums[j+1]:
isEqual = False
break
if isEqual:
print allNums, i, "Answer"
exit()
x *= 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment