for i in range(2, 20):
for x in range(2, i):
if i % x == 0:
break
else:
print(i, "is a prime number")
def is_prime(n: int) -> bool:
"""Primality test using 6k+-1 optimization."""
if n <= 3:
return n > 1
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
while i ** 2 <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6
return True
def check_if_prime():
number = int(input("Enter number: "))
prime_lists = [1,2,3]
divisible_by = []
if number in prime_lists:
return divisible_by
if number==0:
return None
for i in range(2,number):
if number%i==0:
divisible_by.append(i)
return divisible_by
check_if_prime()