2

Suppose a set of weights contains one 1g, one 2g and two 10g. There are 11 different weights that can be achieved by combining these.

Is it possible to come up with a formula that would calculate the number of different combinations possible for any set of weights? (For example, a 2g + 3g and 5g are equal, so will count as only one).

thameera
  • 121

2 Answers2

0

Your example would have 12 weights if you counted weight = 0 as well. This is 2x2x3 different weights.

As long as you cannot produce the same weight in two different ways you just multiply (number of coins plus 1).

Otherwise you can take two coin values and find all their combinations, and may be that’s the only possible duplicates. Say 3 one penny, three two penny, 100 ten-penny. 1+2 produce 10 combinations 0 to 9, so you get 10 x 101 values.

gnasher729
  • 10,113
0

If you have $n$ types of weights, of which $m$ have more than one copy in the sample space with copies $p_1, p_2, \cdots , p_m$; then you can find the total number of combinations as:

$$ \dfrac{n!}{p_1! \cdot p_2! \cdots p_m!} - m $$

The $m$ is subtrated because those $ m $ pieces are not unique and all of them will be counted as a single piece.


In case of $2$g, $3$g and $5$g, you can achieve: $ \dfrac{3!}{0!} = 6 $ combinations: $ 2, 3, 5, 7, 8, 10 $ g respectively.

hjpotter92
  • 3,049