# Math of Human Pyramids

I was writing a blog post today, and I ended up asking the question of how many layers tall a human pyramid would be if it contained all of the people who use Facebook, approximately 750 million.

First I had to define how the pyramid would work. Basically, I ended up with $n$ being the number of layers from the top, and $n^2$ being the number of people in that layer.

So the top layer would be $n=1$ and would contain $n^2=1$ people. Next layer would be $n=2$ and would contain $n^2=4$ people. I ended up writing a simple python script to answer the question, but now I'm wondering about a more generalized answer.

Given $x$ people, how tall would the pyramid be? There's quite possibly a very simple answer to this, but I don't know what it would be.

-
Maybe the square pyramidal numbers would be helpful? You could always set the formula to $x$ many people, and then solve for $n$ somehow. – yunone Aug 23 '11 at 21:53
It seems a retagging is in order, I am unsure what tags are fitting here though. – Asaf Karagila Aug 23 '11 at 22:19
Why would you stack on person on top of 4 people on top of 9 people etc.? Anyway, just set $1+2^2+\dots+n^2=x$, write the LHS using the formula for square pyramid numbers, and then solve the cubic. (You won't get an integer unless $x$ is a valid square pyramid number.) – anon Aug 23 '11 at 22:25
Yeah, I really didn't know what to tag it as. It has to do with numbers, and that's the first thing that came to mind, but if you have anything better, let me know or change it yourself. – Peter Aug 23 '11 at 22:26
Took it upon myself to retag as algebra-precalculus. – Gerry Myerson Aug 24 '11 at 0:37

As yunone has pointed out, there is a formula for the sum of squares, namely

$$\sum_{k=1}^n k^2 = \frac{n(n + 1)(2n + 1)}{6} .$$

So if the sum is about $x$ then $n$ is slightly less than $\sqrt[3]{3x}$, and for large $x$, $\sqrt[3]{3x}-\tfrac{1}{2}$ is a good estimate. With $x=750,000,000$, this suggests something about $1309.87$. Indeed the the sum of the first $1310$ squares is $750,221,935$.

You will also need to multiply by the average height of each layer (remembering that most human pyramids stand on shoulders rather than heads).

-
The $1/2$ comes from the fact that it is the only value $a$ such that the error between $n^3+\frac{3}{2}n^2+\frac{1}{2}n$ and $(n+a)^3$ is linear instead of quadratic in $n$. – anon Aug 23 '11 at 22:51

The sum of the squares of the first $n$ natural numbers is given by:

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

Hence, you need to find $n$ in terms of $x$ using the following equation:

$$n(n+1)(2n+1) - 6x = 0$$

Hence you need to find the real root of the cubic function

$$2n^3 + 2n^2 + n^2 + n - 6x$$

given by $n =$

Thus, for $x = 750,000,000$, we get $n = \lfloor 1309.9 \rfloor$ or $1309$ levels.

Using the average height of a male in the US (1.776m), that's a 2324.8m high pyramid made of $748,505,835$ people!

Here's the closed-form solution in pseudocode:

n = 1/(12*((3*x)/2 + ((9*x^2)/4 - 1/1728)^(1/2))^(1/3)) + ((3*x)/2 + ((9*x^2)/4 - 1/1728)^(1/2))^(1/3) - 1/2

-
Sum of the first $n$ squares. – anon Aug 23 '11 at 22:40
@anon: Thanks!! – Jacob Aug 23 '11 at 23:39
From one of Peter's comments, I gather the folks in the pyramid would be on all fours, not standing, so that 1.776 meter figure is irrelevant. Might be amusing to compute how much weight each person in the bottom layer has to support! – Gerry Myerson Aug 24 '11 at 0:40
Haha true. That would be $\approx 35$ tons per person! – Jacob Aug 24 '11 at 0:44