agonasani wrote:
the top one has 1 block always since it is a pyramide so if you know they are for example 5 layers you can do this:
a=1(since the top layer has one block)+1
layer 2 :a X a(in this case 2X2=4)
layer 3

a+1) X (a+1);(2+1) X (2+1)=3 X 3= 9
layer 4

a+2) X (a+2);(2+2) X (2+2)=4 X 4=16
layer 5

a+3) X (a+3);(2+3) X (2+3)+5 X 5 =25
that works if your math teacher lets you use different ways to solve the problem, but many math teacher want a problem solved in a formula not in an improvised way.
But think how long it takes if there are 500 layers.
The easiest way is to work out the volume of a pyramid: WidthxLengthxHeight/3, and as W=L=H, it can be reduced to (n^3)/3.
But that pyramid has all the side-blocks at a slope, so you need to add a sloping half block for each outer block: +(n^2)/2
and then you need to add a bit more for the corner pieces, all the way up to the top, the corner blocks have 1/3rd the volume of a full block, and you've already added half a block from the previous addition, so you only need to add 1/6th more (1/3 + 1/2 +1/6 = 1), so you add on; +n/6
That leaves you with:
(n^3)/3 + (n^2)/2 + n/6 (which can be reduced to (2n^3 + 3n^2 +n)/6