Maximal number of cubes in a given pyramid I have a pyramid whose base is a square of side length $a=120$, and whose height is also $a=120$. The projection of the summit of the pyramid on the square basis coincides with the center of the square (regular pyramid)

What is the maximal number of cubes of side length $L=5$ that we can have inside the pyramid?

I have no idea how to start. Should I try some "greedy" algorithm? Is there any smart idea to solve this problem?
Any hint would be appreciated! Thank you!
 A: If the base is $120 \times 120$ units, and the height is $120$ units, with the summit directly above the center of the base, then each side has a slope of $2$: one unit towards the center, the side wall rises by two units.
This means that at height $5$ above the base, each side is $5\times\frac{1}{2}=2.5$ inwards, i.e. $115\times 115$ in area, because each of the four sides (north, south, east west) is inwards by that amount. In other words, the bottommost layer of $5 \times 5 \times 5$ blocks covers $115 \times 115$ unit area of the base, and thus consists of $23 \times 23$ blocks.
The next layer of blocks is similarly smaller, covering a $110\times 110$ area on top of the previous layer of blocks, i.e. one block less in both directions, consisting of $22 \times 22$ blocks. (You might note that the center of each block in the upper layer is at the corners of four blocks in the lower layer, although it does not affect the math here at all.)
This continues upwards, with the 23rd layer having just one block. Note that since $23\times 5 = 115$, the summit of the pyramid (a rectangular pyramid itself, of course, with base $5\times 5$ on top of the topmost block, and height another $5$) is empty; it does not have enough room to contain even a single block.
If we count the number of blocks in each layer, we get
$$N = 23 \times 23 + 22 \times 22 + 21 \times 21 + \ldots + 1$$
That is not too hard to do by hand (or, better, calculator; or even with 2×2 Lego bricks),
but mathematically we can also say that
$$N = \sum_{i=1}^{23} i^2$$
As it happens, it is already known (in lists of known sums) that
$$\sum_{i=1}^{n} i^2 = \frac{1}{6} n (n + 1) (2 n + 1)$$
and therefore
$$N = \frac{1}{6} \times 23 \times 24 \times 47 = 4324$$
A: Well, you can calculate the volume of the pyramid and then divide it by the volume of the cubes:
The volume of the pyramid is $V=a^2\frac{h}{3}$ or in this case $V = 120^2\frac{120}{3}$ or $5.76 \times 10^5$ (yay calculators). 
The volume of the cubes would be $V = b \cdot h \cdot w$ or in this case $V = 5 \cdot 5 \cdot 5 = 5^3$ which equals $125$. 
Then, $\frac {5.76 \times 10^5}{125} = 4608$ (again, yay calculators!) meaning, of course, that you can fit 4608 cubes.
Hope this helps!
