The tetrahedral days of Christmas

I’m pretty sure there’s a Peanuts comic strip in which Linus works out how many of each gift was given in the “Twelve Days of Christmas.” I’ve been unable to Google it, because the search results are overwhelmed by links to “A Charlie Brown Christmas.” So I decided to work it out myself.

Update 25 Nov 2024 8:35 PM
Thanks to Andy Napper on Mastodon, here’s the Peanuts strip I was looking for:

Peanuts for 1961-01-30

I browsed GoComics this morning, looking for this strip, but I focused on dates within a week or so of Christmas. I never would have guessed it was published on January 30. Andy found it by using a service I didn’t know about: Peanuts Search.

Linus is clearly using a different version of the lyrics than I am, but his numbers are correct.

It’s obvious that there are 12 partridges in a pear tree, one for each of the 12 days. And it follows that there are 22 turtle doves, two for each of the 11 days after the first. By induction, we can say that the total number of the kth gift is

k(13k)

Here’s a table of the results:

Gift no. Gift Total
1 Partridge in a pear tree 12
2 Turtle doves 22
3 French hens 30
4 Calling birds 36
5 Gold rings 40
6 Geese a-laying 42
7 Swans a-swimming 42
8 Maids a-milking 40
9 Ladies dancing 36
10 Lords a-leaping 30
11 Pipers piping 22
12 Drummers drumming 12

Adding up twelve numbers is easy, especially since the symmetry lets you add just the first six and double it. But let’s work out a formula. We start with

k=1 12k(13k)

which we can break into two parts:

k=1 1213k k=1 12k 2

or

13 k=1 12k k=1 12k 2

The first of these sums is our friend the triangular number,

k=1 nk=n(n+1)2

which we saw in the post on houses of cards. For n=12, the triangular number is

12132=78

The second sum comes from a 3D analog to the triangular numbers, the square pyramidal numbers,

k=1 nk 2=n(n+1)(2n+1)6

The name comes from building a pyramid of balls with a square base. The top row has just one ball; the row under it has four; the row under that has nine, and so on. The kth pyramidal number is the total number of balls in a pyramid with n rows. For n=12, the square pyramidal number is

1213256=650

So our total gift count is

1378650=1014650=364

which is coincidentally close to the number of days in a year.

We could have kept the formulas algebraic and worked out a single simple formula for the total number of gifts:

k=1 nk(n+1k)=n(n+1)(n+2)6

This turns out to be a tetrahedral number. Tetrahedral numbers are also called triangular pyramidal numbers; they’re similar to the square pyramidal number but with a triangular base instead of a square.

After working it out, this answer seems obvious in retrospect. It comes from adding the gifts day-by-day instead of gift-by-gift. On the first day, there’s one gift (a partridge); on the second day, there are three gifts (two calling birds and a partridge); on the third day, there are six gifts (three French hens, two calling birds, and a partridge). Each day, you add the next triangular number, which is exactly how the tetrahedral numbers are constructed.

After doing this, I looked up tetrahedral numbers in the Online Encyclopedia of Integer Sequences. It’s sequence A000292, and one of the examples given in the comments is “the number of gifts received from the lyricist’s true love up to and including day n in the song ‘The Twelve Days of Christmas.’” Doing that first would’ve saved me some time, but wouldn’t have been any fun.