# Minimum number of weights you need to define any integer weight from 1 to N

Following this question What's the fewest weights you need to balance any weight from 1 to 40 pounds?

I am interested what is the minimum number M of weights you need to define any integer weight from a) 1 to 40? b) 1 to N?

For example, if N = 2, M = 1. Indeed, with one weight equal 2 you can define any weight X from 1 to 2 ( $1 \le X < 2 \implies X = 1$; $X = 2 \implies X = 2$ ).

With two weights I can go up to N = 8. Take weights 2 and 6, then:
$1 \le X < 2 \implies X = 1$;
$X = 2 \implies X = 2$;
$2 < X < 6-2 \implies X = 3$;
$X = 6-2 \implies X = 4$;
$6-2 < X < 6 \implies X = 5$;
$X = 6 \implies X = 6$;
$6 < X < 6+2 \implies X = 7$;
$X = 6+2 \implies X = 8$.

If you can weigh all the even numbers, you can define all the odd numbers. The question you linked to has the weights as powers of $3: 3^0=1, 3^1=3, 3^2=9, 3^3=27$ and can weigh all numbers up to $40$. So doubling the weights (as you started) $2,6,18,54$ allows you to define all weights up to $81$. More generally, the series of weights $2\cdot 3^i$, for $i=0,1,2,\dots n$ lets you define all weights up to $3^{n+1}$