Unify primality checking (#6228)

* renames prime functions and occurances in comments

* changes implementation of primality testing to be uniform

* adds static typing as per conventions

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Nikos Giachoudis
2022-07-11 10:36:57 -04:00
committed by GitHub
parent dad789d903
commit f7c58e4c4b
5 changed files with 87 additions and 53 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
from .hash_table import HashTable
from .number_theory.prime_numbers import check_prime, next_prime
from .number_theory.prime_numbers import is_prime, next_prime
class DoubleHash(HashTable):
@ -15,7 +15,7 @@ class DoubleHash(HashTable):
next_prime_gt = (
next_prime(value % self.size_table)
if not check_prime(value % self.size_table)
if not is_prime(value % self.size_table)
else value % self.size_table
) # gt = bigger than
return next_prime_gt - (data % next_prime_gt)