Math: Five numbers with unique amounts

So, I need to figure out how to get 5 numbers, and when you add all 2 of them, this will lead to the amount you can get by adding these two numbers.

Here is an example of what I am saying, but with 3 numbers:

1
3
5

1 + 3 = 4
1 + 5 = 6
3 + 5 = 8

Adding any two of these numbers will result in a unique amount that cannot be found by adding any other pair of numbers. I need to do this, but with 5 different numbers. And if you have a way to figure out how to do this, with any number of numbers, a separation that will also be appreciated. Thanks you

+6
source share
3 answers

1, 10, 100, 10000, 100000 gives you the five numbers you want.

In the general case, 1, 10, 100, 1000, ..., 10^k , where k is the number of numbers you need.

And even more general, you can say b^0, b^1, ..., b^k , where b >= 2 . Note that you have a special property that not only all pairwise sums are unique, but all the sums of a subset are unique (just look at the representations in base b ).

+10
source

Set {1, 2, 5, 11, 21} also works.

You can start with a set of two or three elements that correspond to this property (any operation of adding two elements from the set {1,2,5} gives you a unique sum) and includes only the next number, which is considered if adding current elements and this The new item also gives you unique amounts.

Run Example:

Suppose our starter set S is S={1,2,5} . Let U be the set of all sums between two elements in S Elements in S give us unique sums 1+2=3 , 1+5=6 , 2+5=7 , so U={3,6,7} .

Consider Appendix 11 to this set. We need to check that 1+11 , 2+11 and 5+11 all give us amounts that are not visible in U , and they are all unique to each other.

1+11=12 , 2+11=13 , 5+11=17 .

Since 12 , 13 and 17 are the only sums between themselves and are not found in U , we can update S and U as follows: S1 = {1,2,5,11} U1 = {3,6,7,12,13,17} .

You can do the same procedure for 21 , and you should (hopefully) get: S2 = {1,2,5,11,21} U2 = {3,6,7,12,13,17,22,23,26,32} .

If all you need is a speed dial, the solution Jason posted is much faster.

+3
source
 1 2 4 8 16 1 3 9 27 81 

suggests x ^ n, where n is a member of a subset of natural numbers

+2
source

Source: https://habr.com/ru/post/915527/


All Articles