How to weigh up to 100kg with 5 weights 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.
 A: 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.
A: If you used $1,2,4,8..$ kg weights, you could measure until $127$ kg only using seven different weights on one side of scale. Because numbers $0-127$ is written with maximum seven digits in base $2$, i.e. $100=1100100_2$. You can use only one side of scale because you only have $0$ and $1$ digits in base $2$. 
On the other hand, in base $3$ you have $1,0,2$ and you can use max five digits to represent numbers in $0-100$. But you have to repeat weights if you use just one side of scale due to digit $2$. But you can rewrite a number in base $3$ as substraction of two numbers in the same base which have only digits $0$ and $1$. For example, $7=21_3$, which means you have to use two $3$ kg and one $1$ kg to measure $7$ kg if you only use one side of scale. But since you are not restricted to only one side, you can write $7$ as $101_3-10_3$. You put $101_3=10$ kg to left side, $7$ kg and $10_3=3$ kg to right.
A: Minimum weight is 1 kg max is 18 kg
You can obtain 25337 combinations
Here is the code
a = 1
Do While a < 100
   b = a + 1
   Do While b < 100
    c = b + 1
    Do While c < 100
        d = c + 1
        Do While d < 100
            e = d + 1
            Do While e < 100
                total = a + b + c + d + e
                If total = 100 Then
                    counter= counter + 1
                    Text1.Text = counter
                End If
                e = e + 1
                DoEvents
            Loop
            d = d + 1
        Loop
        c = c + 1
    Loop
    b = b + 1
Loop
a = a + 1
If a > 18 Then
    Text2.Text = "THE END"
End If

Loop
