Skip to content

Instantly share code, notes, and snippets.

@anivarth
Created June 22, 2016 14:37
Project Euler Problem 57 Solution With Python
# http://radiusofcircle.blogspot.com
# time module
import time
# time at the start of program execution
start = time.time()
# p
p = 1
# q
q = 1
# counter
counter = 0
# 1000 iterations
for i in xrange(1000):
a1 = p + 2*q
b1 = p + q
if len(str(a1)) > len(str(b1)):
counter += 1
p = a1
q = b1
# printing the counter
print counter
# time at the end of program execution
end = time.time()
# total time of execution
print end - start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment