Last active
August 29, 2015 14:08
-
-
Save ayushgoel/0c201ecd03ee6df9c37d to your computer and use it in GitHub Desktop.
Project Euler 52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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