from datetime import datetime
def factorize(x):
counter = 0
List = []
while (x >= 4) and x % 2 == 0:
x /= 2
List.append(2)
d = 3
q = x / d
while (q >= d):
if (x % d == 0):
x = q
List.append(d)
else:
d += 2
q = x / d
List.append(x)
return len(set(List))
def Euler47():
counter = 3
List = [4, 4, 4, 4]
dim = {3:1, 4:1, 5:1}
while True:
Next = factorize(counter + 3)
dim[counter + 3] = Next
Con = [dim[j] for j in xrange(counter, counter + 4)]
if Con == List:
return counter
counter += 1
def main():
start = datetime.now()
answer = Euler47()
end = datetime.now()
print end - start, answer
if __name__ == "__main__":
main()