- #1

baby_1

- 154

- 14

i know that it shows Remaining for example

5 mod 3=2

1 mod 3=1

but if i select negative number what does it do?

example:

-10 mod 27 =?

Thanks

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter baby_1
- Start date

- #1

baby_1

- 154

- 14

i know that it shows Remaining for example

5 mod 3=2

1 mod 3=1

but if i select negative number what does it do?

example:

-10 mod 27 =?

Thanks

- #2

SteveL27

- 799

- 7

i know that it shows Remaining for example

5 mod 3=2

1 mod 3=1

but if i select negative number what does it do?

example:

-10 mod 27 =?

Thanks

In math, mod is defined as a relation, rather than an operator. So we would say

5 [itex]\equiv[/itex] 2 (mod 3)

and

1 [itex]\equiv[/itex] 1 (mod 3)

where the [itex]\equiv[/itex] in this context is pronounced "is congruent to."

In other words a mod-n statement returns "true" or "false" when applied to pairs of numbers. The general rule is that

a [itex]\equiv[/itex] b (mod n) if the number n divides a - b.

Now a lot of people come to mod from programming languages, where mod is not a relation, but is rather an

5 mod 3=2

and so forth.

But even though 5 [itex]\equiv[/itex] 2 (mod 3), it's also true that 5 [itex]\equiv[/itex] 47 (mod 3), right? Both 47 and 5 give the same remainder when divided by 3. [That's equivalent to the definition I gave earlier; but you should actually convince yourself of that]

So if someone asks us what is 5 mod 3, what should the answer be? The convention is that we take the unique number x such that 5 [itex]\equiv[/itex] x (mod 3) and x is greater than or equal to 0, but less than 3.

With that background, what is the answer to -10 mod 27 = ?

Well, let's find x such that -10 [itex]\equiv[/itex] = x (mod 27), and x is between 0 and 26 inclusive. A moment's thought will convince you that x = 17 is the right answer here. So

-10 mod 27 = 17

That's because

a) -10 - 17 is divisible by 27; and

b) 17 is the unique number with that property that's also between 0 and 26, inclusive.

That's a long answer but it's everything you need to know to make sense of this kind of problem.

Last edited:

- #3

Bacle2

Science Advisor

- 1,089

- 10

i know that it shows Remaining for example

5 mod 3=2

1 mod 3=1

but if i select negative number what does it do?

example:

-10 mod 27 =?

Thanks

Maybe a quick way of answering is a=b mod c is equivalent to : c|(b-a) , or, the

remainder of dividing a by c is b*. And complement it with Stevel27's answer.

* This is a technical point, since we usually choose the remainder to be within

a given range, but we can add multiples.

- #4

baby_1

- 154

- 14

you are my best teacher that dedicate your time to telling me the right answer.

Thanks again

- #5

Bacle2

Science Advisor

- 1,089

- 10

That's how I like it, Stevel27 does 99%+ of the work and we split the credit in half ;) .

- #6

SteveL27

- 799

- 7

That's how I like it, Stevel27 does 99%+ of the work and we split the credit in half ;) .

I don't mind. I got 99% of the cash reward :-)

Share:

- Last Post

- Replies
- 4

- Views
- 429

- Last Post

- Replies
- 4

- Views
- 420

- Replies
- 4

- Views
- 555

- Last Post

- Replies
- 1

- Views
- 611

- Last Post

- Replies
- 3

- Views
- 564

- Last Post

- Replies
- 7

- Views
- 306

- Replies
- 2

- Views
- 296

- Last Post

- Replies
- 2

- Views
- 366

- Replies
- 14

- Views
- 685

- Last Post

- Replies
- 0

- Views
- 666