6
$\begingroup$

As part of an answer to a Stack Overflow question I made the assumption that if I choose two distinct positive integers $m$ and $n$, them give you $m - n$ and $m$ XOR $n$, then you can uniquely determine what $m$ and $n$ were. For all the examples I've tried this seems to work correctly, though I have no reason to believe that this should work in general. Moreover, I'm not familiar enough with the interactions of differences (or sums, for that matter) and XOR to deivse a proof or counterexample.

Is my claim true? If so, how would you go about proving it? If not, is there a nice counterexample?

Thanks so much!

2 Answers 2

9

I believe this is false.

Let $2^r \gt m \gt n$.

Then

$2^r + m$ and $2^r +n$ have same difference and XOR as $m,n$.

2

How about (2,3) and (16,17)? plus some characters