Created
June 23, 2016 16:48
-
-
Save Itsdenty/2fc05a4502770ed9c539aeb455c73f08 to your computer and use it in GitHub Desktop.
python prime number check function
This file contains hidden or 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
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