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

code refactoring

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