# Constructing $N$ unit cubes

I was trying to solve the problem of construction $N$ unit cubes, and while searching I came across this sequence at OEIS.

This is exactly what I need but I could not find a method to generate the series. How do you think this can be derived?

I'm not sure it is generated by a series, because such would suppose that 10 cubes would naturally follow off nine, which follows off 8.

For example, eight cubes is 2*2*2, which leads 18 lines in each direction (or 54). Adding an extra cube to the side of this would make 62. But a 3*3*1 construction gives 16 vertical, and 8*3*2 horizontal, ie 48 (total 64). So 2*2*2 + 1*1*1 is more efficient here.

For 10, one would add an extra cube adjacent to the two already there, giving 67 (four horizontal, and 2 vertical). Likewise, 11 puts an extra four sides of the cube, and adds 5 extra edges (72), For 12, one has 2*2*3 to give 75.

So it looks like they're keeping close to the cube, adding either 8, 5, or 3 as there are either 1, 2 or 3 already completed sides. Obviously the first cube has 12 edges, since there are none new.

I tend to think it's an experimental result. It seems though the most efficient way is to make first a cubeoid, of the product of $m$ and $m+1$. The residue makes a polygon less than $m+1$, which is made into $n, n+1$, and the remainder is set to one side.

We can divide the series 12, 8, 5, 3 into "4, 3, 2, 3", where every cube requires at least 3 edges. It is then how many edge cubes are needed.

The 4 is used exactly once: it makes a square face which we extend into a cube.

The 3 is used on each side of the cube, where $m$ is the largest cube not larger than N, we have $3m + x$, where x=0 if $N=m^3$, x=1 if $N=m^3+m^2$, and x=2 if $N=m(m+1)^2$. If it lies between these ranges, add 1.

The 2 is used to form the 'faces' of the large cube. It corresponds to $(m)(m+1)$ for each complete cuboid face, and $2n+1, 2$ according to the remaining over the cuboid.

The remainder 3 is applied to all cubes, ie $3N$.

So you end up with $4+3m^2+2n+3N+x$, where $x is the residue part of the broken fraction. • I am sure it is not experimental because it is a question on link-eolimp and if you think 2D version of this problem (constructing squares) the solution would be$2N + ceil(2*sqrt(N))\$ so it might be constructed from that observation but i could not – kadircet Dec 10 '13 at 12:12
• When you come to add a cube to a structure, there can be one, two or three faces already present, meaning that 8, 5 or 3 new edges are needed. It seems that the most efficient way of making such a thing is to keep the assembly as cubic as possible, and try to minimise the 8 and 5 cubes. For example, for 31, one can make it as 27 (ie a product of numbers p and p+1), then the difference is made as a product of q^2, or q(q+1), and the rest added to the end. – wendy.krieger Dec 11 '13 at 7:51