0
$\begingroup$

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

$\endgroup$
0
$\begingroup$

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

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.