Credit for this problem goes to dailybrainteaser. Thanks!

Minimum number of weights


You can place weights on both side of weighing balance and you need to measure all weights between 1 and 1000. For example if you have weights 1 and 3, now you can measure 1,3 and 4, and also you can measure 2, by placing 3 on one side and 1 on the side which contain the substance to be weighed. What is the minimum set of weights you need to measure all weights from 1kg to 1000kg.