Saturday, 21 December 2013

modular arithmetic - Remainder is less than divisor



I'm reading a book and it says the equation
$$ a \bmod n = a - n \left\lfloor\frac{a}{n}\right\rfloor$$
follows that $$ 0 \leq a \bmod n \lt n. $$



I understand that the remainder is less than divisor, but I can't understand how the author got it from the first equation. Could someone, please, explain it to me?



Answer



As $\lfloor x\rfloor \le x<\lfloor x\rfloor +1$, we have
$$ 0\le \frac an-\left\lfloor \frac an\right\rfloor <1$$
and after multiplication with $n$ the claim.


No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...