# XOR of three integers where each pair's XOR is the other integer

I have three positive integers, a, b, and c. I know that $$a\oplus b\oplus c=0$$, so I got that each pairwise xor has to be the other positive integer. $$a\oplus b=c$$, $$b\oplus c=a$$, and so on, but I can't find a, b, and c.

There are lots of solutions, (I'm pretty sure), I'm just trying to code a quick way to find all of the solutions

## 1 Answer

There are infinitely many solutions: choose $$a=b\in\mathbb N, c=0$$ and then $$a\oplus b\oplus c=0$$.

To find all solutions, choose an arbitrary $$c\in\mathbb N$$. We want to find all $$a,b$$ with $$a\oplus b=c$$. Its equivalent to $$a=b\oplus c$$, so for every $$b\in\mathbb N$$ we would choose $$a=b\oplus c$$ and $$a,b,c$$ would be a valid solution.

All of the solutions are of this form - and therefore thats how you can iterate through every possible solution to the question

• As explained, the set of solutions is 2-dimensional in that 3-dimensional space--it's a big "infinitely many". – Zachary Vance Nov 7 '20 at 7:12