Skip to content

Instantly share code, notes, and snippets.

@sincerefly
Last active August 29, 2015 14:20
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 sincerefly/cafd4e727c2b6885e5d4 to your computer and use it in GitHub Desktop.
Save sincerefly/cafd4e727c2b6885e5d4 to your computer and use it in GitHub Desktop.
python判断素数
import math
def isPrime(n):
if n <= 1:
return False
for i in range(2, int(math.sqrt(n)) + 1):
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