Your question is Prime Number Coding. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Within an EVERSANA patient-support workflow, validate whether an integer identifier or generated numeric value is prime. Implement a function that returns whether the given number has exactly two positive divisors: 1 and itself.
Implement is_prime(n), where n is an integer. Return True if n is prime and False otherwise. Numbers less than 2 are not prime.
Your solution should avoid checking every number up to n. A divisor larger than the square root of n must be paired with a divisor smaller than the square root, so testing through the square root is sufficient.
def is_prime(n):