import math

# Returns True if n is a prime; False otherwise
def isPrime(n):
    factor = 2 # initial value of possible factor
    factorUpperBound = math.sqrt(n) # the largest possible factor we need to test is sqrt(n)
    
    # loop to generate and test all possible factors
    while (factor <= factorUpperBound):
        # test if n is evenly divisible by factor
        if (n % factor == 0):
            return False
        
        factor = factor + 1
        
    return True
