Length of Hilbert Curve in 3 Dimensions The Hilbert Curve is a continuous space filling curve. The length of the $n^{th}$ iteration in two dimensions can be calculated by $2^n-\frac{1}{2^n}$. The curve can be generalized to fill volumes; what is the length of the $n^{th}$ iteration of the Hilbert Curve in three dimensions?

In $2$ dimensions the square is divided into $2^n$ by $2^n$ smaller squares ($n$ is the iteration). The majority of squares contain $2$ lines of length $1/2^n$ except for two, giving us $2(2^n * 2^n -1)/2^n$. 
In 3 dimensions there is still $2$ lines in the majority of cubes so wee need only adjust things to account for the $3$rd axis, giving $2(2^n \cdot 2^n \cdot 2^n -1)/2^n$. 
In general we have $2(2^dn-1)/2^n$, where $d$ stands for the number of dimensions.
