Skip to content

Instantly share code, notes, and snippets.

View Somtoo62's full-sized avatar

Somtoochukwu. Somtoo62

View GitHub Profile
import math
def is_prime(n):
# Prime numbers must be greater than 1
if n < 2:
return False
# Check for factors from 2 up to the square root of n
# This is the most efficient basic way to check for primality
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0: