Doing modular division when denominator and modulus not coprime

Правка en1, от shpvb, 2019-06-25 22:46:05

I looked for it and got a source: Link

But this method may not work when the denominator is a multiple of modulus.

For example, (8/8) % 4 should be 1, but applying this approach it gets gcd(4, 8) = 4 and hence find ((8/4)/(8/4))%(4/4) which results in 0.

Similarly for (80/8) % 4 should be 2 but this results in 0.

So what can be a generalized approach towards this?

Теги #modular_theory, modular arithmetic

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский shpvb 2019-06-25 22:46:05 571 Initial revision (published)