A question based on bitwise AND

Q. What can we say about positive integers a, b if a\text{~\&~}b = a ?

(\&) denotes the bitwise AND operator.

They are either equal, or the bits set in A are also set in B.

1 Like

I think you meant the reverse. The bits set in A are set in B.

1 Like

Yeah, thanks for correction. Edited

  1. a|b = b
  2. ( a \oplus b ) + a = b
  3. ( b- a ) | a = b
  4. ( b- a ) \oplus a = b
  5. (b - a) \& a = 0
  6. a \epsilon b
4 Likes

Either ‘a’, ‘b’ must be equal Or ‘b’ must be ‘1’ i.e., all the bits are set to ‘1’. In this two cases as per my knowledge a & b == a