Simplify primality test conditions

Refactor primality test logic for clarity and efficiency.
This commit is contained in:
Bill Buchanan
2026-01-15 18:29:41 +00:00
committed by GitHub
parent 2bc924e3d7
commit dfc2ffe1ca

View File

@@ -12,15 +12,10 @@ def get_if_prime(val):
for k in range(0, 10000):
testval = 6 * k + 1;
if (testval>max):
break
if (val % testval == 0):
if (val % testval == 0):
return (False)
testval = 6 * k - 1;
if (testval>max):
break
if (val % testval == 0):
testval = 6 * k - 1;
if (val % testval == 0):
return (False)
return (true)