Skip to content

Instantly share code, notes, and snippets.

@Itsdenty
Created June 23, 2016 16:48
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 Itsdenty/2fc05a4502770ed9c539aeb455c73f08 to your computer and use it in GitHub Desktop.
Save Itsdenty/2fc05a4502770ed9c539aeb455c73f08 to your computer and use it in GitHub Desktop.
python prime number check function
def prime_number(x):
if x <2:
return False
if x==2:
return True
if not x & 1:
return False
for n in range (3,int(x**0.5)+1,2):
if x%n == 0:
return False
else:
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment