
-----------------------------------
aqazwsx1
Wed Jan 28, 2009 5:20 pm

Mod Help!
-----------------------------------
Hi, I was wonder how the mod function works? Why does 2 mod 7 =2? Thanks! :D

-----------------------------------
saltpro15
Wed Jan 28, 2009 5:24 pm

RE:Mod Help!
-----------------------------------
the mod is the remainder left over after the numbers are divided

-----------------------------------
jbking
Wed Jan 28, 2009 5:29 pm

RE:Mod Help!
-----------------------------------
Mod is simply the remainder when a division is done.  Another way to think about this is the following if you want a more technical interpretation:

a mod b = x where x+bk = a for some integer k.

Note, that x doesn't have to be between 0 and b-1 though this is usually how it is expressed.

-----------------------------------
aqazwsx1
Wed Jan 28, 2009 5:36 pm

Re: Mod Help!
-----------------------------------
doesn't 2  mod 7 = 6 ? Why is it 2 ?

-----------------------------------
Tony
Wed Jan 28, 2009 5:44 pm

RE:Mod Help!
-----------------------------------
how do you figure it to be 6?

-----------------------------------
aqazwsx1
Wed Jan 28, 2009 5:48 pm

Re: Mod Help!
-----------------------------------
2/7 so        , you add a "0. " so you make the 2 into a 20 , then you find 7*2=14 , so 20-14=6

-----------------------------------
jbking
Wed Jan 28, 2009 5:55 pm

Re: Mod Help!
-----------------------------------
doesn't 2  mod 7 = 6 ? Why is it 2 ?

No, but 2 mod 7 = 9, since 7+2=9 which means that for k=1 the expression 7k+2 evaluates to 9, in case you were looking at the number upside down.

This presumes that you understand some basics on division, which can be structured in the following way:
a divided by b gives a quotient of c and a remainder of d satisfies the following equation:

b*c+d = a

Thus, if we take 2 and divide it by 7, there is a quotient of 0 and a remainder of 2, not 6.

-----------------------------------
aqazwsx1
Wed Jan 28, 2009 6:15 pm

Re: Mod Help!
-----------------------------------
ok thanks
