Skip to content

Instantly share code, notes, and snippets.

@joehakimrahme
Created July 4, 2012 15:59
Show Gist options
  • Save joehakimrahme/3048041 to your computer and use it in GitHub Desktop.
Save joehakimrahme/3048041 to your computer and use it in GitHub Desktop.
isprime - even
import math.sqrt as sqrt
def prime3(n):
if n<=1:
return False
if n % 2 == 0 and n != 2:
return False
for i in xrange(2, int(sqrt(n)), 2):
if n % i == 0:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment