Height of Square Pyramid created of Spheres A square pyramid is constructed with 1015 spheres, with diameter $6$, such that the top layer has $1$ sphere, the next has $4$ spheres, then $9$, etc. How many layers are in the pyramid? What is the height of the pyramid?
I calculated $14$ layers, but I need guidance on how to calculate the height of the pyramid.
I think I could create a right triangle where the hypotenuse is the distance from the center of a corner sphere to the center of the top sphere. The other legs would be the 1. Height of the pyramid, and 2. Center of corner sphere to center of the middle sphere of the bottom row.
Hypotenuse $= 6 \cdot 14 = 84$
Leg 2 $= \frac{1}{2} \sqrt{2} \cdot 84$
Leg 1 must then be $= 3528$ inch $= 294$ feet
Let me know whether this seems correct.
 A: Your ideas are in the right direction. I'll attempt to derive a formula for the height of a square pyramid $n$-levels high. If we start with the case of a pyramid with $2$ layers, we can make our analysis easier by taking a cross-section of the pyramid as follows:
After this, we can mark the quantities that we need to calculate the height of the pyramid $H_2(r)$ as follows:

Where the radius $\color{green}{r}$ is denoted by a green line segment between 2 points, and the length $\color{red}{h}$ is denoted by a red line segment between 2 points. Notice that because of symmetry a right-angle triangle with sidelengths $h$ and hypothenuse $2r$ appears. Using the Pythagorean theorem we thus see that
$$
h^2 + h^2 = (2r)^2 \color{blue}{\implies} h =\frac{2r}{\sqrt{2}} = \sqrt{2} r \tag{1}
$$
And now, from the above diagram we see that the total height of the pyramid (from the highest point of the top sphere to the lowest of the bottom one) is given by
$$
H_2(r) =\color{green}{r} + \color{red}{h}+ \color{green}{r} \overset{\color{blue}{(1)}}{=} r +  \sqrt{2} r +r = r \left(2 + \sqrt{2} \right)
$$
Finally, to generalize this we just need to see what happens when we add more layers. For example, in the 3-layer-heigh pyramid we see the following:

Where we see that the total height got increased by $\color{red}{h}$ compared to the previous $2$-layer-high case. This means that for every new layer we need to add one more $h$ to our height. Using this, we can establish that for a pyramid made of balls of radius $r$ that's $n$-layers-high, the height the pyramid is given by
$$
H_n(r) = \color{green}{r}+  \underbrace{\color{red}{h} +  \color{red}{h}+...+  \color{red}{h}}_{n-1 \text{ times}} + \color{green}{r} = 2r +(n-1)h \overset{\color{blue}{(1)}}{=} \boxed{r\left[2 + (n-1)\sqrt{2} \right] }
$$

Since you calculated correctly that the pyramid with $1015$ balls has $14$ layers, then we just need to plug in $n = 14$ and the radius $r = 3$ in the formula obtained above. We thus find that the height of the pyramid is
$$
H_{14}(3) =  (3)\left[2 + (14-1)\sqrt{2} \right] = 6 + 39 \sqrt{2} \approx 61.154
$$
