I recently stumbled upon a problem which seems very easy, but I can't seem to find the solution.
If we have five positive numbers: { X1, X2, X3, X4, X5 }, we can form ten distinct pairs of these five numbers. Given the sum of each pair, you are asked to find the original five numbers.
All numbers are positive integers bellow 1,000,000,000.
Any hints or solutions would be appreciated. :D
Hint: Sum up all pairs and see what happens!
Explanation:
Let's say our numbers are a, b, c, d, e.
Then our pairs will be: a + b, a + c, a + d, ..., d + e.
If we sum up all the pairs we've 4 * (a + b + c + d + e).
If we divide by 4, then we have x = a + b + c + d + e.
And from now if we want to get, for example e, we choose a + b and c + d and x - (a + b) - (c + d) = e.
And you can do that for all the five numbers!
Hope it helps! Have nice day :)
Thank you very much, I solved it! And have a nice day too :D
You're welcome! Thanks :)
I am not a mathematician but i want to share a process that i think it may work for You
lets do some math . As you mention 5 numbers are X1 , X2 , X3 , X4 , X5 and what we have ( X1 + X2 ) , ( X1 + X3 ) + (X1 + X4 ) + ( X1 + X5 ) + ( X2 + X3 ) + ( X2 + X4 ) + ( X2 + X5 ) + ( X3 + X4 ) + ( X3 + X5 ) + ( X4 + X5 ) == TOTAL_OF_ALL_PAIR_NUMBERS
-> 4X1 + 4X2 + 4X3 + 4X4 + 4X5 == TOTAL_OF_ALL_PAIR_NUMBERS
SO ( X1 + X2 + X3 + X4 + X5 ) = ( TOTAL_OF_ALL_PAIR_NUMERS)/4 == TOTAL
`now we have total of all numbers . Now take any pair of number . Assume its ( X1 + X2 ) . So what we have now X3 + X4 + X5 = total — ( X1 + X2 ) . As we take one pair there other nine pair remaining . take 3 pair and check if these 3 pairs can only form by X3 + X4 + X5 or not . How we can ensure that this 3 pair can only form by these X3 + X4 + X5 . If and only if ( X3 + X4 ) + ( X3 + X5 ) + ( X4 + X5 ) == 2 * ( X3 + X4 + X5 ) . Thats means TOTAL — ( X1 + X2 ) == ( X3 + X4 + X5 )/2 . When we sure about our chosen 3 pair we can easily find what is the value of X3 , X4 and X5 are . As X3 = ( Total — ( X1 + X2 ) + ( X4 + X5 ) . Do the process one more time . Surely we find one unknown number X1 or X2 ' . There should be more simple process .