Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A mod b

  1. Feb 21, 2008 #1
    I believe i say this question in a test some where, could anyone tell me what the hell b mod (a) is
  2. jcsd
  3. Feb 21, 2008 #2
    It's called modulo. "b mod a" is the remainder of b/a.
    Example: 8 mod 5 is 3, 6 mod 2 is 0, 7 mod 8 is 7.
  4. Feb 21, 2008 #3
    if b is 15 and a is 4, then you can write

    15 = 4*3 + 1

    the thing that you have to plus, namely 1, is b mod a, so 15 mod 4 is 1. When you have to take the biggest integer and multiply with the a, such that you don't get a bigger number than b, then what you have to add is b mod a.


    b = a*n+c

    then b mod a = c.

    where c is the smallest positive number so b = a*n+c is true
  5. Feb 21, 2008 #4
    Slightly lost
  6. Feb 21, 2008 #5
    you got two integers a and b. Try two write b as a integer n times a that is thry to write

    b = a*n

    for some integer n. You will see that this is not possible if not a devides b. So what is the next you could try, you vould try

    b = a*n + c

    where c in an integer. This can always be done, but c is not unique ex.

    b=20 a=3 then

    20 = 3*7-1 or 20 = 3*6+2 or 20 = 3*4+8

    so how could we make this c unique? If we demand that c is positive and that c is the smallest number possible then it is unique, then the only answer would be


    so now c is unique, and we call that c for b mod a, pronunced b modulo a.
  7. Feb 21, 2008 #6
    I think modulo is easier to understand with a practical example. Think af an old analog clock with two hands and 12 numbers, it is modulo 12.

    With a clock, you can't go past 12 o' clock, whenever you do, you just start from 0 again. This is excactly what modulo is. So if you have the time 14:00, we all know that it's 2 o' clock, and mathematically it's just 14 mod(12) = 2.

    Hope it helps.
  8. Feb 21, 2008 #7
    Kurt, just apply the division algorithm to a and b.

    a/b = q and a remainder r, well, that r is the result of "a mod b"

    Example: 25/4 = 6 and the remainder 1. Then, 25 mod 4 = 1

    I hope they're not teaching you that New Math I keep hearing about.
  9. Feb 21, 2008 #8
    Not exactly a new problem...
    http://video.google.com/videoplay?docid=7767962508395763455 [Broken]
    Last edited by a moderator: May 3, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook