TITLE: Different bricks making a cube
QUESTION [7 upvotes]: We want to build an $n \times n \times n$ cube using bricks that have integer sides and are all different.  As a function of $n$, what is the maximum number of bricks we can use?  For $n=1$ or $2$ it is $1$.  For $n=3$ we can use four, one way is $1 \times 1 \times 1, 1 \times 1 \times 2, 1 \times 2 \times 3, 2 \times 3 \times 3$  For the linked question I have shown that $a(10) \le 52$ by finding that the sum of the volumes of the smallest $53$ blocks is over $1000$.  Are there better results available?
Prompted by this question.

REPLY [8 votes]: You can solve the problem via integer linear programming as follows.
Let $B$ be the set of bricks, with each brick defined by which cells it contains.
For each cell $(i,j,k)\in\{1,\dots,n\}^3$, let $B_{i,j,k}$ be the set of bricks that contain that cell.
For each brick type $t$ (determined by the dimensions, ignoring the placement and orientation), let $B_t$ be the set of bricks of that type.
For each brick $b$, let binary decision variable $x_b$ indicate whether $b$ is used.
The problem is to maximize $\sum_b x_b$ subject to:
\begin{align}
\sum_{b\in B_{i,j,k}} x_b &= 1 &&\text{for all $i,j,k$} \tag1\\
\sum_{b\in B_t} x_b &\le 1 &&\text{for all $t$} \tag2
\end{align}
The results for small $n$ are:
\begin{matrix}
n &1 &2 &3 &4 &5 &6 &7 &8 &9 &10\\
\hline
a(n) &1 &1 &6 &10 &15 &21 &28 &35 &43 &52
\end{matrix}
For example, here is an optimal solution for $n=3$:
\begin{matrix}
1\times 3 \times 3 &\{(1,1,1),(1,1,2),(1,1,3),(1,2,1),(1,2,2),(1,2,3),(1,3,1),(1,3,2),(1,3,3)\}\\
2\times 2\times 2 &\{(2,1,1),(2,1,2),(2,2,1),(2,2,2),(3,1,1),(3,1,2),(3,2,1),(3,2,2)\}\\
1\times 2\times 2 &\{(2,1,3),(2,2,3),(3,1,3),(3,2,3)\}\\
1\times 1\times 2 &\{(2,3,1),(2,3,2)\}\\
1\times 1\times 1 &\{(2,3,3)\}\\
1\times 1\times 3 &\{(3,3,1),(3,3,2),(3,3,3)\}
\end{matrix}

To obtain an upper bound, you can relax to a one-dimensional knapsack-type problem.  Let $v_b$ be the volume of brick $b$.  Now aggregate constraint ($1$) to
$$
\sum_{b\in B} v_b x_b = n^3 \tag{1'}
$$
and maximize $\sum_b x_b$ subject to ($1'$) and ($2$).  In fact, you can omit ($2$) if you arbitrarily keep one representative of each brick type, yielding a 0-1 equality knapsack problem.  For $n \le 10$, this upper bound matches $a(n)$.  For $n\in \{11,\dots,20\}$, upper bounds are as follows:
\begin{matrix}
n &11 &12 &13 &14 &15 &16 &17 &18 &19 &20\\
\hline
\text{upper bound} &61 &71 &82 &94 &105 &118 &131 &144 & 159 & 173
\end{matrix}