mirror of
https://gitlab.com/mfocko/CodeWars.git
synced 2024-11-08 18:49:07 +01:00
16 lines
283 B
Python
16 lines
283 B
Python
import math
|
|
|
|
def is_prime(num):
|
|
if num <= 1:
|
|
return False
|
|
elif num == 2:
|
|
return True
|
|
elif num % 2 == 0:
|
|
return False
|
|
|
|
bound = int(math.ceil(math.sqrt(num)))
|
|
|
|
for div in range(3, bound + 1, 2):
|
|
if num % div == 0:
|
|
return False
|
|
return True
|