0

The total number of blocks within pyramids on Minecraft doesn't quite correspond with Square pyramidal numbers (on Wikipedia). Because of the blocky nature of the environment, the "even rows" of the pyramid are missed out. So, a simple 3-block-high pyramid has $1 + 9 + 25 = 35$ blocks.

Hence the sum for a pyramid of height $n$ is given by $$\sum_{k=1}^n(2k - 1)^2$$

What's the corresponding shortcut formula for this series, involving $n^3$ ?

Lord_Farin
  • 17,743
David B
  • 113
  • I'm not sure what I was thinking not asking Wolfram Alpha first:

    http://www.wolframalpha.com/input/?i=sum+1+to+k+of+%282k%E2%88%921%29%5E2

    Wolfram doesn't show the substitutions it used, though; I'd expect you can get Mathematica to show them.

    – David B Oct 09 '15 at 13:10

2 Answers2

1

So we look for $$ P_n := \sum_{k=1}^n (2k-1)^2 $$ for an $n$-layer pyramid. We have $(2k-1)^2 = 4k^2 - 4k + 1$, hence \begin{align*} P_n &= 4\sum_{k=1}^n k^2 - 4\sum_{k=1}^n k + n \\ &= 4\cdot \frac 16\cdot n(n+1)(2n+1) - 4 \cdot \frac 12 n \cdot (n+1) + n\\ &= \frac 23 \cdot (2n^3 + 3n^2 + n) - 2n² -2n + n\\ &= \frac 43 n^3 + \frac 23 n - n\\ &= \frac 13 n (4n^2-1) \end{align*}

martini
  • 84,101
-1

Okay, well we know that:

$$\sum_{i=1}^ni^2=\frac{1}{6}n(n+1)(2n+1)$$

What you want is to skip out the $4$ and the $16$ and so forth layers right?

Well you actually mean to say "you want the odd layers" which is actually:

$\sum_{i=1}^n(2i-1)^2=1^2+3^2+5^2+\cdots$

Notice that:

$$\sum^n_{i=1}(2i-1)^2=\sum^n_{i=1}[4i^2-4i+1]=\sum^n_{i=1}4i^2-\sum^n_{i=1}4i+\sum^n_{i=1}1$$

This is of course $=4\sum^n_{i=1}i^2-4\sum^n_{i=1}i+n$

Which we know to be $=\frac{4}{6}n(n+1)(2n+1)+n-4\sum^n_{i=1}i$

Note that $$\sum^n_{i=1}i=\frac{1}{2}n(n+1)$$

Thus:

$$\sum^n_{i=1}(2i-1)^2=\frac{2}{3}n(n+1)(2n+1)+n-2n(n+1)$$

I leave you to do the factoring.

Alec Teal
  • 5,515
  • 3
  • 36
  • 59
  • Thanks! First fraction should be $2/3$ rather than $1/3$ in your expansion. Then the numbers match. – David B Oct 09 '15 at 11:55