def solution(n: int) -> bool:
# your code here
if n > 1:
for i in range(2, n):
if n % i == 0:
return False
else:
return True
else:
return False
assert solution(7) is True
assert solution(5099) is True
assert solution(45) is False
def solution(n: int) -> bool:
# your code here
if n > 1:
i = 2
while i * i <= n:
if n % i == 0:
return False
i += 1
return True
else:
return False
assert solution(7) is True
assert solution(5099) is True
assert solution(45) is False
def solution(n: int)-> bool:
# your code here
flag = 2
while flag < n:
if n % flag == 0:
return False
flag += 1
return True
assert solution(7) is True
assert solution(5099) is True
assert solution(45) is False
def solution(n: int)-> bool:
import math
if n< 2 or (n>2 and n%2 == 0):
return False
else:
for i in range(3,int(math.sqrt(n))+1,2):
if n%i ==0:
return False
return True
def solution(n: int)-> bool:
if n>1:
for i in range(2,n):
if n%i==0:
return False
return True
else:
return False
assert solution(7) is True
assert solution(5099) is True
assert solution(45) is False
def solution(n: int)-> bool:
# your code here
if n == 1:
return True
for i in range(2, n // 2 + 1):
if n % i == 0:
return False
else:
return True
assert solution(7) is True
assert solution(5099) is True
assert solution(45) is False
assert solution(2) is True
def solution(n: int)-> bool:
for i in range(2,n):
if n%i == 0:
return False
return True
assert solution(7) is True
assert solution(5099) is True
assert solution(45) is False
assert solution(2) is True
assert solution(1) is True
def solution(n: int)-> bool:
for i in range(2,n):
if n%i==0:
return False
return True
assert solution(7) is True
assert solution(5099) is True
assert solution(45) is False