Created
September 23, 2011 15:39
-
-
Save msalahi/1237690 to your computer and use it in GitHub Desktop.
MuradWeek8Solution
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
from time import time | |
from math import sqrt | |
def disproves(n): | |
i=2 | |
while i*i*2<n: | |
diff = n-i*i*2 | |
if not any(diff%j==0 for j in xrange(3,int(sqrt(diff))+1,2)) :return False | |
i+=1 | |
return True | |
n=3 | |
t1 = time() | |
while True: | |
if any(n%i==0 for i in xrange(3,int(sqrt(n)+1),2)): | |
if disproves(n): break | |
n+=2 | |
t2 = time() | |
print n,":", t2-t1,"sec" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment