Skip to content

Instantly share code, notes, and snippets.

@cpdean
Forked from msalahi/muradWeek8.py
Created September 23, 2011 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpdean/1237976 to your computer and use it in GitHub Desktop.
Save cpdean/1237976 to your computer and use it in GitHub Desktop.
MuradWeek8Solution
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