Filling a barrel, using small containers

35 Views Asked by At

In how many ways, using containers, one with 2 liters and other with 7 liters, can you fill a barrel of 1234 liters? What's the fastest and what's the slowest way to fill the barrel?

Should I use formula for permutation n!/(n−r)! or the other formula n!/r!-(n−r)! . In similar tasks I don't know which formula should be used.

Can anyone help? Thank you in advance!

1

There are 1 best solutions below

2
On BEST ANSWER

If the order of using the $2$ and $7$ liter barrels does not matter then you do not need combinations or permutations. You simply need to find the number of solutions to

$2a + 7b = 1234$

where $a$ and $b$ are non-negative integers (you can use $0$ barrels of either size, but you cannot use $-1$ barrels).

So the minimum value of $a$ is $0$. And the maximum value is $\frac{1234}{2}=617$. So we have

$0 \le a \le 617$

In addition, to make $7b=1234 - 2a$ a multiple of $7$, we must have $a \mod 7 = 1$.

So $a$ can be $1, 8, 15, 22, \dots, 610, 617$. The corresponding values of $b$ are $176, 174, 172, 170, \dots, 2, 0$.

From this you should be able to work out how many possible values there are for $a$ and $b$.