mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 18:49:26 +08:00
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038) * refactor: Fix naming conventions (#7038) * Update arithmetic_analysis/lu_decomposition.py Co-authored-by: Christian Clauss <cclauss@me.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038) * chore: Fix naming conventions in doctests (#7038) * fix: Temporarily disable project euler problem 104 (#7069) * chore: Fix naming conventions in doctests (#7038) Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -13,7 +13,7 @@ import math
|
||||
import random
|
||||
|
||||
|
||||
def rsafactor(d: int, e: int, N: int) -> list[int]:
|
||||
def rsafactor(d: int, e: int, n: int) -> list[int]:
|
||||
"""
|
||||
This function returns the factors of N, where p*q=N
|
||||
Return: [p, q]
|
||||
@ -35,16 +35,16 @@ def rsafactor(d: int, e: int, N: int) -> list[int]:
|
||||
p = 0
|
||||
q = 0
|
||||
while p == 0:
|
||||
g = random.randint(2, N - 1)
|
||||
g = random.randint(2, n - 1)
|
||||
t = k
|
||||
while True:
|
||||
if t % 2 == 0:
|
||||
t = t // 2
|
||||
x = (g**t) % N
|
||||
y = math.gcd(x - 1, N)
|
||||
x = (g**t) % n
|
||||
y = math.gcd(x - 1, n)
|
||||
if x > 1 and y > 1:
|
||||
p = y
|
||||
q = N // y
|
||||
q = n // y
|
||||
break # find the correct factors
|
||||
else:
|
||||
break # t is not divisible by 2, break and choose another g
|
||||
|
Reference in New Issue
Block a user