PDA

View Full Version : sum of unique powers of 3


ged25
Jul22-09, 03:19 PM
I have this problem where I'm having trouble solving so any help would be appreciated.

Here's the problem:
You have a balancing scale and a set of unique weights. Each weight that you have is a power of 3 ie you have weights 1,3,9,27 etc. You are given a weight w.
The problem is to tell which weight goes on which pan so that the scale is balanced.

For example:
Suppose you are given weight with value 35.

Solution:
The left pan will have 35 + 1 = 36
The right pan will have 27 + 9 = 36

Another example with weight 52.
The left pan will have 52 + 27 + 3 = 82
The right pan will have 81 + 1 = 82

I hope the problem is clear.

I haven't gotten further than understanding that value on the pans must be 3x or 3x + 1.

tiny-tim
Jul22-09, 03:52 PM
Hi ged25! Welcome to PF! :wink:
I haven't gotten further than understanding that value on the pans must be 3x or 3x + 1.

yup, that's a bit obvious, and I'm afraid won't help you. :redface:

Hint: try it for the easiest cases, of weights of 1 up to 8, find a symbolic way of writing the answers, and see if you can find a pattern. :smile:

CRGreathouse
Jul22-09, 06:00 PM
You know how to write numbers in base-3 (ternary), right?

There's a direct correspondence between writing numbers in *balanced* ternary and the solution to this problem. Ordinary ternary uses the digits {0, 1, 2}; balanced ternary uses {-1, 0, 1}.