Two weeks ago we posed a puzzle about Ferrero Rocher chocolates.

In that puzzle we asked the number of chocolates in a pile ten layers tall where the pile was a tetrahedron. That is with one chocolate at the top resting on three chocolates in the layer below, and so on.

And we followed this by asking if there was a formula for a pile of any height.

This week we have changed the pile to a Pyramid. That is with one chocolate at the top resting on four chocolates in the layer below, and so on.

So how many chocolates are in a pile ten layers tall?

And following on from this, is there a formula to calculate the number of chocolates in a pile of any height?

Each of the layers in the pile (or pyramid) is a square, and so the numbers of chocolates in each of the layers are successive square numbers. That is, 1, 4, 9, 16 and so on.

So taking the two parts of the puzzle in reverse order, to calculate the number of chocolates in a pyramid of n layers, we need to sum the first n square numbers. And there is a formula for that:

$$ \frac{n(n + 1)(2n + 1)}{6} $$

We can see it is correct when n = 1

$$ \frac{1 x 2 x 3}{6} = 1 $$

and when n = 2

$$ \frac{2 x 3 x 5}{6} = 5 $$

So to answer the first part last, when n = 10

$$ \frac{10 x 11 x 21}{6} = 385 $$