Remove duplicate is_prime related functions (#5892)

* Fixes (#5434)

* Update ciphers.rabin_miller.py
         maths.miller_rabin.py

* Fixing ERROR maths/miller_rabin.py - ModuleNotFoundError and changing project_euler's isPrime to is_prime function names

* Update sol1.py

* fix: try to change to list

* fix pre-commit

* fix capital letters

* Update miller_rabin.py

* Update rabin_miller.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
This commit is contained in:
Paulo S. G. Ferraz
2022-04-08 14:40:45 -03:00
committed by GitHub
parent 1d3d18bcd2
commit 1400cb86ff
6 changed files with 37 additions and 38 deletions

View File

@@ -25,7 +25,7 @@ def rabinMiller(num: int) -> bool:
return True
def isPrime(num: int) -> bool:
def is_prime_low_num(num: int) -> bool:
if num < 2:
return False
@@ -213,11 +213,11 @@ def isPrime(num: int) -> bool:
def generateLargePrime(keysize: int = 1024) -> int:
while True:
num = random.randrange(2 ** (keysize - 1), 2 ** (keysize))
if isPrime(num):
if is_prime_low_num(num):
return num
if __name__ == "__main__":
num = generateLargePrime()
print(("Prime number:", num))
print(("isPrime:", isPrime(num)))
print(("is_prime_low_num:", is_prime_low_num(num)))