1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Boolean and modulo

  1. Jul 15, 2010 #1
    Please do you know if (a&b)modp(where &stands for bitwise boolean AND operator)is the same as (amodp)&(bmodp)?Or can you direct me to somewhere i can find more information on this?Thanks.
     
  2. jcsd
  3. Jul 19, 2010 #2
    No, consider 6&5 mod 11.
     
  4. Jul 19, 2010 #3

    Mark44

    Staff: Mentor

    How is this a counterexample?
    (6 & 5) % 11 == 4 % 11 == 4
    (6 % 11) & (5 % 11) == 6 & 5 == 4

    (Since you're using the C/C++ bitwise AND operator, I'm using the C/C++ modulus operator, %.)
     
  5. Jul 20, 2010 #4

    kjl

    User Avatar

    How about:

    (4&5) % 3 == 4 % 3 == 1
    but
    (4%3) & (5%3) == 1 & 2 == 0
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Boolean and modulo
  1. Factoring Modulo (Replies: 1)

  2. Boolean algebra. (Replies: 4)

  3. Boolean functions (Replies: 13)

  4. Modulo Equation (Replies: 7)

  5. The modulo operator (Replies: 8)

Loading...