Professional Documents
Culture Documents
Multiplicative Inverse
Multiplicative Inverse
Multiplicative Inverse
5A mod 96 = 1
We want to find value of A such that it satisfies
above Equation i.e. we want to find out a number B
which is relatively co-prime to A such that
gcd(A,B)=1
SGLakhdive@RMCollege,Pune
Table Algorithm
Let A1 = 1, A2= 0 and A3 = 96
2. Let B1 = 0, B2= 1 and B3 = 5
3. Find quotient Q = A3 / B3 (integer Division)
4. Copy the values of
A1 = B1, A2= B2 and A3 = B3
5. Compute the new values for B1, B2, B3 as follows
B1 = A1 (Q * B1)
B2 = A2 (Q * B2)
B3 = A3 (Q * B3)
6. If B3 != 1 the goto step no 3.
7. B = B2 mod M
1.
SGLakhdive@RMCollege,Pune
5A mod 96
Q
96/5
=19
A1
A2
A3
B1
B2
B3
96
-19
-19 mod 96 = 77
31A mod 105
SGLakhdive@RMCollege,Pune
A1
A2
A3
B1
B2
B3
105
31
105/31
=3
31
-3
12
31/12=
2
-3
12
-2
12/7 = 1 -2
-10
7/5 = 1
-10
-5
17
5/2 = 2
-5
17
13
-44