I think this is what's going on here. You're looking at the number of cubes in a sequence of figures of which an example is shown. Let's look at the number of cubes in each layer: call that L(n). Each layer is composed of a number of rows each of which has an odd number of cubes in it. So L(n) = 1 + 3 + 5 + ... + (2n-1) + (2n+1) + (2n-1) + ... + 5 + 3 + 1 = sigma_{i=0}^{n} (2i+1) + sigma_{i=0}^{n-1} (2i+1). Now sigma_{i=0}^n i = n(n+1)/2 so sigma_{i=0}^n 2i+1 = n(n+1) + n+1 = (n+1)^2. So L(n) = (n+1)^2 + n^2 = 2n^2 + 2n + 1. The whole figure has F(n) = 1 + 5 + ... + L(n-1) + L(n) + L(n-1) + ... + 5 + 1 = sigma_{i=1}^n L(n) + sigma_{i=1}^{n-1} L(n) cubes in it. To evaluate this you need to know that sigma_{i=1}^n n^2 = n(n+1)(2n+1)/6.