How can the formula be found for this problem? We have a truck that we need to completely fill up with merchandise. We have an infinite supply of merchandise of dimension $1\times1\times1, 2\times2\times2, 4\times4\times4, 8\times8\times8, 16\times16\times16, \ldots, 2^k \times 2^k \times 2^k$ for all $k\ge 0$. (Infinite supply of merchandise of each dimension too!)
We wish to fill the truck of dimension $A\times B\times C$ completely using only these merchandise. Given $A, B, C$, what is the smallest number of merchandise we will need to fill the truck completely?
Eg
1 1 1
Ans 1
1 2 3
Ans 6
3 4 5
Ans 32 (4 boxes of 2*2*2 and 28 of 1*1*1
 A: By the binary nature of sizes, it seems plausible that the greedy approach is optimal.
If that can be justified, the answer can be found as follows:
Let $k$ be maximal with $2^k\le \min\{A,B,C\}$. Then use $\lfloor \frac A{2^k}\rfloor \cdot \lfloor \frac B{2^k}\rfloor \cdot \lfloor \frac C{2^k}\rfloor $ boxes of size $2^k$. Next compute the number of boxes for $(A\bmod 2^k)\times B \times C$, for $(2^k\lfloor \frac A{2^k}\rfloor)\times (B\bmod 2^k)\times C$ and for $(2^k\lfloor \frac A{2^k}\rfloor)\times (2^k\lfloor \frac B{2^k}\rfloor)\times (C\bmod 2^k)$ and add. Note that these subproblems will have all items $\le 2^{k-1}$.
Why does the greedy approch work? (This is somewhat informal)
Among all optimal solutions select one that maximizes the number of items that are justified according to their size (i.e. the vertices have coordinates divisible by the item side length) and among those select one that prefers big boxes at lower coordinates (if you allow this informal description).
Assume that this deviates from the greedy solution. Then there must exist both boxes that are bigger and boxes that are smaller than the boxes at the corresponding position of the greedy solution.
Among such "too small" boxes, consider one closest to the origin. Then (looesly speaking)  by some swapping operations one can move a bigger box into its position, contradicting the choice of this minimal counterexample ...
