# If XOR of n distinct numbers is ANDed over one of the number, the result would be zero

Say we Have n distinct numbers

x1,x2,....xn


And we xor the result

xoredResult = x1^x2...^xn


And if we AND(&) with one of the number say x2 We get Zero

xoredResult & x2 = 0


Can we always claim that if the ANDed result is zero that the number is repeated ? Can this be used to find the first repeated element in a stream of numbers ?

• You are saying that $(a \oplus b) \wedge b = 0$ if $a = 0$ and $b=1$ then the output is 1 – kelalaka Dec 23 '19 at 20:12

It doesn't work, for example if x2 = 0 then xoredResult & x2 = 0 all the time no matter what else the set of numbers contains.
Or for an other example, the set { 1, 2, 3 } xors to zero (so it ANDed by any of its members, or even anything else, yields zero) but contains no repeated elements.