Let's call one of the pyramid's faces it's "front".
For any given level of balls N, (as counted from the top), the "front row" will contain N balls. For example the first row from the top, will have 1 ball "in front", the second one will have two, and so on till at level 12, there are 12 balls along the front face of the pyramid.
In the row behind the front row, where will be one ball present for each space between two balls in the front row. Since for level N, there would be N-1 such hollows, the row behind the front row on level N would contain N-1 balls: 11 on the 12th level, 1 on the second, and the first level does not have a second row.
Generally, each row further from the front face of the pyramid will have one less ball in it than the row before. Therefore, for any level N, the number of balls in the level would be N+(N-1)+(N-2)+...+1. This can be expressed as N*(N+1)/2
So if we have 12 levels, We need to calculate the sum of
N*(N+1)/2 for N from 1 to 12. After a lot of arithmetics, this comes out to be 364.
(TomM has managed to further reduce the equation here) |