# Can two positive integers be uniquely recovered from their difference and XOR?

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

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$.

-

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

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 11, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9430542588233948, "perplexity_flag": "head"}