mirror of
https://gitlab.com/mfocko/CodeWars.git
synced 2024-11-09 02:59:06 +01:00
17 lines
283 B
Python
17 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
|