mirror of
https://github.com/billbuchanan/appliedcrypto.git
synced 2026-02-20 13:50:42 +00:00
Simplify primality test conditions
Refactor primality test logic for clarity and efficiency.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user