categories: computer science
Hello everyone,
Below you will find a video with a detailed explanation of the algorithm for determining a prime number. Its operation, time complexity, and usefulness. Below you will also find ready-made code to copy if needed.
Code:
import math
a = int(input())
def pierwsza(a):
if a < 2:
return False
for i in range(2, int(math.sqrt(a)) + 1):
if a % i == 0:
return False
return True
print(pierwsza(a))
Video:
Thank you for reading!
Read more