Suppose there are containers with volumes(integers) $V1, V2, \cdots, VN$ where $V1 =1$, and rest of the containers are distinct but not necessarily consecutive. Each container can be available/used more than once for filling liquids.
Is there a formula rather than use brute-force to calculate minimum number of containers(irrespective of capacity) required to pack exactly a liquid of volume(integer) "$V$"?
Should be something along the lines of:
$f(v, n) = floor(v/n)$ if v % n = 0
$f(v, n) = 1 + floor(v/n)$ if v % n $\ne$ 0