1) You are a shopkeeper who is selling sugar between 1-100 kg .Now you have to design 5 weights in such a way that any integer weight between 1-100 can be measured in a single attempt ,without using more than 5 weights.You can’t repeat weights.
He gave me time like 1 hour to figure it out, and i tried it as hard as i could. But finally i couldn’t figure out more than this that weights have to be distributed on both sides of measurement.
Does anybody have some clue as what could be the answer.
Use powers of 3: 1,3,9,27,81 can weigh anything up to 121.
The trick is to place weights on both sides of the pan. Without that, the maximum you can do is with powers of two, and five of those will allow you to go up to 63. At least if you only consider exact weighings. If you’re allowed to infer that the weight is 14 if it is heavier than 13 and lighter than 15 will probably allow you to go a bit higher, and I don’t yet see a systematic way of going about this.
121 is the maximum you can do with 5 weights. See http://www.uri.edu/artsci/math/clark/mthdl/scale/explore.pdf for necessary and sufficient conditions.
On the other hand, since you can optimally go up to 121, there is some choice if you only want to go up to 100. There are 132 sets of weights that work, 15 of them measuring up to exactly 100, and the lexicographically smallest one is 1,3,7,22,67.
Further, the proof for sufficiency is constructive. That is, you can figure out an algorithm to tell you which weights go on which side for any of these sets of weights.