# Answers for stacking this week:

1) Someone wants to make a courthouse memorial using cannon balls. They lay the balls out in a square first, then pile the balls into a square pyramid with no balls left over. What’s smallest number of cannon balls used?

Start with a quadrahedral pyramid of base 1, you have 1 ball. Add one layer of base 2, you have 1+4 balls. Another layer of base 3 gives 1+4+9 balls. The next layer with a base of 4 gives 1+4+9+16 balls. Keep doing this until you get a pyramid with an integer square root number of balls, which will give you a pyramid 24 layers tall and 4,900 total cannon balls.

2) A grocer stacks oranges into two tetrahedral pyramids (each base has 3 sides). By combining the two into one big tetrahedral pyramid, what’s the smallest number of oranges he needs if the two smaller pyramids are the same sizes? If they are different sizes?

First, for balls laid out in a triangle, to get the next layer, you just add the next integer. That is, if you start with one ball and go to two, 1+2=3. The next layer is 1+2+3=6 balls; then it’s 1+2+3+4=10 balls.

Same sized pyramids: 20 (two 3-layer pyramids of 10 balls each. 1+3+6=10. 1+3+6+10=20)
Different sized pyramids: 680 (120 and 560) (for 15 layers, 8 layers and 14 layers respectively)

The formula is: 1/6n(n+1)(n+2) — eq. 1
Tetrahedral (layer, total)
1 – 1
2 – 4
3 – 10
4 – 20
5 – 35
6 – 56
7 – 84
8 – 120
etc.

What’s interesting here is that we can apply the calculus of finite differences to our pyramid.
0 1 4 10 20
1 3 6 10
2 3 4
1 1

Now, I’d skipped the part in the previous chapter where Gardner switched from simply using the party trick of reproducing a polynomial of power x^2, and jumped to using Newton’s formula. That’s

a + bn + cn(n-1)/2 + dn(n-1)(n-2)/2*3 + en(n-1)(n-2)(n-3)/2*3*4 …

where a is the first value of the first line
b is the first value of the second line
c is the first value of the third line,
etc.

For the party trick,

a + bn + cn(n-1)/2
a + bn + 1/2*cn^2 – 1/2*cn
a + (b-1/2c)n + c/2n^2

Or,
(c/2)*x^2 + (b – c/2)*x + a

And yes, this is the way the party trick works.

So, how about the tetrahedral pyramid problem?

0 1 4 10 20
1 3 6 10
2 3 4
1 1

0 + 1*n + 2*n(n-1)/2 + 1*n(n-1)(n-2)/6
n + n(n-1) + n(n-1)(n-2)/6
n + n^2 – n + (n^2 – n)(n – 2)/6
n^2 + (n^3 – 2n^2 – n^2 + 2n)/6
1/6n^3 + n^2 – 3/6n^2 + 2/6n
1/6n^3 + n^2 – 1/2n^2 + 1/3n
1/6n^3 + 1/2n^2 + 1/3n       — eq. 2

Simplified, we get: 1/6n(n^2 + 3n + 2)
which is: 1/6n(n + 1)(n + 2)

Which is eq. 1 I gave above for the tetrahedral table.

The generalized form, if you want to try the party trick approach, would be:

a + bn + cn(n-1)/2 + dn(n-1)(n-2)/2*3
a + bn + c/2*n^2 – cn/2 + d/6*(n^2 – n)(n – 2)
a + bn – cn/2 + c/2*n^2 + d/6(n^3 – 3n^2 + 2n)
a + (bn – cn/2 + 2dn/6) + (c/2*n^2 – 3d/6n^2) + d/6*n^3
a + (b – c/2 + d/3)n + (c/2 – d/2)n^2 + (d/6)n^3

(d/6)n^3 + ((c – d)/2)n^2 + (b – c/2 + d/3)n + a

In other words, the multiplier for x^3 is 1/6 of the bottom line.
The multiplier for x^2 is the first value on line 3 minus the first value on line 4, divided by 2.
The multiplier for x is the first value of line 2 minus half of the value on line 3 plus 1/3 of the value on line 4.
The constant a is just the first value on line 1.

Verifying the tetrahedral formula with the party trick:
x^3 -> 1/6
x^2 -> (2-1)/2 = 1/2
x -> 1 – 2/2 + 1/3 = 1/3

1/6*x^3 + 1/2*x^2 + 1/3*x matches up with eq. 2 above

Final comments: When I first started writing this entry, I was thinking it was going to take maybe no more than 15-20 minutes, because I was simplifying what Gardner wrote, and skipping a lot of the details of packing types. But, when I got to the puzzles for the week, I discovered that I really had no idea how to get to the answers on my own. I’d been relying on the answers in Gardner’s book and not checking my understanding of them. It took 5 hours to get everything straightened out in my head, and now my head hurts.

### 1 Comment

1. #### Garth

/  August 10, 2017

Funny you should talk about this. I just watched this episode of Dara O’Briain’s School Of Hard Sums and they talk about stacking cannon balls. It’s a British TV show about math problems.

This site uses Akismet to reduce spam. Learn how your comment data is processed.