0
$\begingroup$

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?

$\endgroup$
  • 1
    $\begingroup$ The positive remainder of (for example) $-15$ when divided by $13$ is $11$, because the multiple of $13$ less than or equal to $-15$ is $-26$. $\endgroup$ – Joffan Dec 11 '17 at 5:57
  • 2
    $\begingroup$ The obvious thing you missed is the negative sign. $\endgroup$ – Matthew Leingang Dec 11 '17 at 5:59
5
$\begingroup$

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

So, the minimum positive remainder is $3$

| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

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}$

| cite | improve this answer | |
$\endgroup$
0
$\begingroup$

$101 \equiv 10 \bmod 13$

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

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.