# two sets of unique integers...

• Oct 30th 2006, 05:38 PM
hashmap
two sets of unique integers...
i am coding a simple game. it consists of a balance (as in, a set of scales) and a set of items that may be placed on it.

the object is to place the correct items on the scale, such that it balances. there is only one possible solution to the problem.

what i'm looking for, then, is a set of numbers with two (and only two) subsets whose sums are equal. i realize how important linguistic precision is with respect to mathematical discussions, so if my meaning isn't clear, let me know.

how do i approach this problem logically? the set in this instance is quite small, but i'd llike to be able to apply what i learn here - if anything ;) - to similar problems in the future.
• Oct 31st 2006, 09:38 PM
Soroban
Hello, hashmap!

I don't know how heavy those items are, so I can't answer your question.
. . But I think I have some valuable input.

A balance scale automatically demands thinking in the base-3 system.

You wish to measure whole-number amounts from 1 to 40 pounds
on a balance scale. .How many weights will you need?

The surprising answer is four weights: 1, 3, 9, and 27 (powers of 3).

To weigh 19 pounds of sand:
. . place the 1 and 27 in the right pan
. . place the 9 in the left pan
. . add sand to the left pan until the pans balance.

There is an elegant algorithm for determining where the weights should be placed
for any given amount. .If you (or anyone) is interested, I'd be happy to explain it.

• Nov 1st 2006, 08:21 AM
hashmap
thanks for the reply, soroban, but i think we're on the wrong track.

lets say i need 12 weights.

they are numbered, 1 - 12.

if i put 1,2,5,6,7 and 11 on one side and the others on the other side, the scale will balance. there are no other possible combinations.

i need to figure out the masses of the 12 items so that there are only those two possible combinations.