Skip to content
Snippets Groups Projects
Commit af25cad9 authored by quentin.fasler's avatar quentin.fasler
Browse files

code refactoring

parent ad31f8bc
Branches
No related tags found
No related merge requests found
......@@ -124,10 +124,9 @@ def compute_bachet_bezout(a, b):
def modular_inverse(a, n):
bachet_bezout = compute_bachet_bezout(a,n)
modular_inverse = bachet_bezout[0]
if a * modular_inverse % n == 1:
return modular_inverse
coefficients = compute_bachet_bezout(a, n)
if a * coefficients[0] % n == 1:
return coefficients[0] % n
return None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment