Now that I understand your need, what is your question? Given a number, let's say 21, how would you determine if that number is prime or not on scratch paper?
import math
def isPrime(x):
"""Returns True if x is prime or False if x is not prime."""
if x <= 1:
return False
else:
y = int(math.sqrt(x))
while x % y != 0:
y -= 1
if y == 1:
return True
else:
return False
Comment