Enter your values below and click "Calculate". The Extended Euclidean Algorithm is used to find the modular inverse, N', which is calculated automatically when N or R changes.
(T * R⁻¹) mod Nm so T + m*N is divisible by R
The core idea is to transform T into a new number that is both a multiple of R and congruent to T modulo N. We can add any multiple of N to T without changing the result modulo N, because m*N ≡ 0 (mod N).
We choose m such that the new number, T + m*N, is perfectly divisible by R. This gives us the condition:
(T + m*N) ≡ 0 (mod R)
Solving for m, we get:
m*N ≡ -T (mod R)
m ≡ -T * N⁻¹ (mod R)
To make this easier to compute, we first find N' = -N⁻¹ (mod R). Then the formula for m becomes:
m ≡ (T mod R) * N' (mod R)
We calculate N' in two parts:
N⁻¹ (mod R), using the Extended Euclidean Algorithm.N'.
Modular Inverse of N (N⁻¹ mod R) =
N' = -N⁻¹ mod R =
Now we can find m using our formula:
Calculated m =
t = (T + m*N) / R
T =
m*N =
T + m*N =
t = (T + m*N) / R =
Final result (adjusted):