# math.isqrt() for Python version 3.8 def isPrime(n): if n < 2: return False for i in range(2, isqrt(n) + 1): if n % 2 == 0: return False return True