Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Isn't this a very simple question? Obviously, you just need to divide cyclically by numbers, starting with 2, and check whether they divide the original number.
for i in range(2, x+1):
if not x % i:
print(i)
break
import math
for i in range(2, int(math.sqrt(x))+1):
if not x % i:
print(i)
break
else:
print(x)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question