Created
May 10, 2016 15:16
-
-
Save Rushi98/01841d7f56febb773568f6d491e2a596 to your computer and use it in GitHub Desktop.
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
def isprime(n): | |
if n<=1: | |
return False | |
elif n<4: | |
return True | |
elif n%2==0 or n%3==0: | |
return False | |
elif n<9: | |
return True | |
elif n%5==0: | |
return False | |
else: | |
k=5 | |
while k<((n**0.5)//1+1): | |
if n%k==0 or n%(k+2)==0: | |
return False | |
k=k+6 | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment