diff --git a/src/Python/utils.py b/src/Python/utils.py index 2188079..62a3602 100644 --- a/src/Python/utils.py +++ b/src/Python/utils.py @@ -1,4 +1,4 @@ - +import math from functools import wraps @@ -14,3 +14,13 @@ def timeit(name): return result return wrapper return profile + + + +def is_prime(n): + if n % 2 == 0 and n > 2: + return False + for i in range(3, int(math.sqrt(n)) + 1, 2): + if n % i == 0: + return False + return True \ No newline at end of file