0
$\begingroup$

Is it possible to construct a set of numbers of arbitrary size such that any calculation involving addition and subtraction, on any combination of those numbers, produces a unique result?

For example, the set of numbers 1,2,3,4,5 would not satisfy this condition because:

  • 1 + 2 = 3
  • 1 + 5 = 2 + 4 = 6
  • 1 + 2 = 5 - 2 = 3

I'm writing some code that performs calculations on a set of numbers, and I want to set up some default data to perform unit tests on my code. I would like to ensure that all calculations produce a unique result to avoid having any false positives in my tests.

For my case, I need a set of 22 numbers.

This is my first question on mathoverflow. If I've done anything incorrectly, please let me know.

$\endgroup$
0

1 Answer 1

3
$\begingroup$

Taking different powers of 3, i.e. 1,3,9,27,81,... should do the job.

$\endgroup$
2
  • 2
    $\begingroup$ Moreover, this is the minimal choice. $\endgroup$ Commented Nov 12, 2015 at 11:33
  • $\begingroup$ My apologies - I do appear to have asked this question on the wrong site. That said, thanks for your answers - I'll try to work out why that works for myself! Thanks. $\endgroup$ Commented Nov 12, 2015 at 13:37

Not the answer you're looking for? Browse other questions tagged .