-1

I'm trying to determine if I would have a negative or positive remainder. I'm writing a program that would divide $-326$ by $7$. The program gives me $-46$ with a remainder of $-4$, however when I checked some other results online I got that my remainder would be $3$. I'm just unsure which would be the proper remainder in this case.

Thanks

Camilo
  • 21
  • 1
  • $$-46 \cdot 7 + -4 = -326 = -47 \cdot 7 + 3$$ Typically, we want the remainder $r$ so that $0 \leq r \lt 7$ in this case, (7 because we are dividing my 7, i.e., working in mod 7) hence, we have that $-326 = -47\cdot 7 + 3$. The quotient is -47, the remainder is 3. – amWhy May 04 '18 at 22:13
  • That's kind of a question of definitions, $-4\equiv 3\pmod 7$, the result of the division is just different.. I would favor a positive remainder. – Henrik supports the community May 04 '18 at 22:15
  • The program cannot give you -46 with a remainder of 3. Please see my comment above. To get a remainder of $3$, we need the quotient -47 and remainder 3. As $-326 = -47(7) + 3$. – amWhy May 04 '18 at 22:20
  • Thanks for clarifying, @Henrik. Deleted question, will delete this comment too. – amWhy May 04 '18 at 22:29

1 Answers1

0

The remainder is $3$. The reainder of the division of an integer $a$ by a natural number $b$ is always an element of $\{0,1,\ldots,b-1\}$.