Treebeard's Homepage : Stumpers

The Twelve Days of Christmas

"On the first day of Christmas, my true love gave to me: a partridge in a pear tree." On the second day, I get two turtle doves and another partridge, for a total of four presents altogether. (Lots of birds!) So how many presents will I receive after all twelve days of Christmas? And what present will I get the most of? As an advanced stumper, is there a general formula for the n days of Christmas? And as a bonus ecclesiastical stumper, exactly when are the twelve days of Christmas, and what do they signify?

Over the 12 days of Christmas, I receive:

1 + (1+2) + (1+2+3) + ... + (1+2+...+12) =
(12*1) + (11*2) + ... + (2*11) + (1*12) =
364 presents.

I think there's a hidden message in this answer, since that's a present for every day of the year except Christmas, for which He is our gift. Jason was the first to figure out that I get the most geese and swans on the 6th and 7th days, 42 each. After any n days of Christmas, I will get n(n+1)(n+2)/6 presents. And on the mth day of n, I will receive m(n-m+1) presents. Most people guess that the 12 days of Christmas are the 12 days before Christmas, the shopping days. The real 12 days of Christmas run from Christmas Day itself until the Feast of Epiphany on January 6, when the Magi or Wise Men first visited the manger. It's not just a song!

A bonus stumper recently appeared in rec.puzzles. When you sing "The Twelve Days of Christmas", exactly when are you half done? Think before you check my answer. (The song lyrics are available.)

Graybear (aka Charles L. Smith III) sent email with this clear derivation of the general formula:

```Formula? (n^3 + 3*n^2 + 2*n)/6  -or-  [(n)(n+1)(n+2)/6] ...

The method I used to determine the formula was as follows:
I was pretty sure that the formula was a polynomial of the form:

f(n)=a*n^3 + b*n^2 + c*n + d

and substituted in the first several known values for (n, f(n)) e.g.:

1 = a + b + c + d
4 = 8a + 4b + 2c + d
10 = 27a + 9b + 3c + d
20 = 64a + 16b + 4c + d

.: a=1/6, b=1/2, c=1/3, d=0

When I reconstructed the polynomial and factored it, I realized it was
an extrapolation of Gauss' summation of consecutive integers and can be
shown in table form below where each number is the sum of the number
above it and the number to its left.

n	n(n+1)/2	n(n+1)(n+2)/6
1	1	1		1
1	2	3		4
1	3	6		10
1	4	10		20
1	5	15		35
1	6	21		56
1	7	28		84
1	8	36		120
1	9	45		165
1	10	55		220
1	11	66		286
1	12	78		364