0

We see that 25%2==1 but if we try to do (50/2)%2 by the formula:

(a / b) % c = ((a % c) * (b^(-1) % c)) % c

The first term a%c = 50%2 evaluates to zero, thus making the entire term zero. Where am i screwing?

  • 1
    Welcome to MSE! We use something called MathJax here to format mathematics so equations and expressions are easier to read. You can find a tutorial to learn how to do it yourself here: https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference. It's really easy to pick up, trust me. – Robert Howard Aug 10 '18 at 22:51

1 Answers1

0

I'd say that the correct formula is something like

$\frac{a}{b} \bmod c = \frac{a \bmod c}{b \bmod c} \bmod c$

In your example this yields a $\frac{50 \bmod 2}{2 \bmod 2} \bmod 2 = \frac{0}{0} \bmod 2$ which can't be interpreted correctly.

Ronald
  • 762
  • see this link link , it clearly tells the point of modulo inverse for finding (a/b)%c – aditya Raj Aug 11 '18 at 07:29
  • You're working in the field $\mathbb{Z}/2\mathbb{Z}$ and you multiply an expression by $\frac{2}{2}$ which is equivalent to $\frac{0}{0}$. Don't be surprised if you get unexpected results. – Ronald Aug 12 '18 at 08:16