Calculator
For the Euclidean Algorithm, Extended Euclidean Algorithm and multiplicative inverse.
Before you use this calculator
If you're used to a different notation, the output of the calculator might confuse you at first.
Even though this is basically the same as the notation you expect. If that happens, don't panic.
Just make sure to have a look the following pages first and then it will all make sense:
- Euclidean Algorithm
For the basics and the table notation - Extended Euclidean Algorithm
Unless you only want to use this calculator for the basic Euclidean Algorithm. - Modular multiplicative inverse
in case you are interested in calculating the modular multiplicative inverse of a number modulo n
using the Extended Euclidean Algorithm
Input
Choose which algorithm you would like to use.
Enter the input numbers. Note that you need to enter n before b.
E.g. if you want to know the multiplicative inverse of 26 mod 11, then use n=11 and b=26.
Output
This is the calculation for finding the multiplicative inverse of 583 mod 943 using the Extended Euclidean Algorithm:n | b | q | r | t1 | t2 | t3 |
---|---|---|---|---|---|---|
943 | 583 | 1 | 360 | 0 | 1 | -1 |
583 | 360 | 1 | 223 | 1 | -1 | 2 |
360 | 223 | 1 | 137 | -1 | 2 | -3 |
223 | 137 | 1 | 86 | 2 | -3 | 5 |
137 | 86 | 1 | 51 | -3 | 5 | -8 |
86 | 51 | 1 | 35 | 5 | -8 | 13 |
51 | 35 | 1 | 16 | -8 | 13 | -21 |
35 | 16 | 2 | 3 | 13 | -21 | 55 |
16 | 3 | 5 | 1 | -21 | 55 | -296 |
3 | 1 | 3 | 0 | 55 | -296 | 943 |
So t = -296. Now we still have to apply mod n to that number:
-296 mod 943 ≡ 647
So the multiplicative inverse of 583 modulo 943 is 647.
Let i be the answer we just found, so i=647. We also have b=583 and n=943.
If our answer is correct, then i × b (mod n) ≡ 1 (mod n)
.
Let's see if that's indeed the case.
i × b (mod n) ≡
647 × 583 (mod 943) ≡
377201 (mod 943) ≡
1 (mod 943)
i × b (mod n) ≡ 1 (mod n)
, so our calculation is correct!