0

Following the formula found here (r = a - (a/b)b) I have been successfully finding the remainder for several problems, but when I try to solve -101 mod 13, I get the answer 10 even though it should apparently be 3.

101/13 = 7.769, ignore everything after the .
13 * 7 = 91
101 - 91 = 10

Am I missing something obvious here?

3 Answers3

5

$$-101=-13\cdot7-10=-8\cdot13+3$$

So, the minimum positive remainder is $3$

1

Well in modular arithmetic if $a \equiv b \pmod m$ then $-a \equiv \ -b \pmod m$

Since $101$ is congruent to $10 \pmod {13}$ $(101 = 13 \times 7 + 10)$ then $-101$ is congruent to $-10 \pmod{ 13}$

However, the remainder mod m is defined as a non-negative integer $ r $ in the interval $[0,m-1]$

So we just add 13 to get $-101 \equiv -10+13 \equiv 3 \pmod {13}$

0

$101 \equiv 10 \bmod 13$

Therefore $-101 \equiv -10 \equiv 3 \bmod 13$

Joffan
  • 40,356