Skip to content

Instantly share code, notes, and snippets.

@PaburoTC
Created January 6, 2021 09:29
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 PaburoTC/94c4cea427e0877262a602c245503805 to your computer and use it in GitHub Desktop.
Save PaburoTC/94c4cea427e0877262a602c245503805 to your computer and use it in GitHub Desktop.
import math
def is_prime(n):
"""Determines if a non-negative integer is prime."""
if n < 2:
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