We had a seasonal pub lunch with neighbours, and my christmas cracker included the question:

*“How many gifts would you have if you received all the gifts in the song ‘The Twelve Days of Christmas’?”*

The song indicates the following gifts I will receive on each day:

on 1st day I’ll receive, a partridge in a pear tree;

on 2nd day, 2 turtle doves and a partidge in a pear tree;

on 3rd day, 3 French hens, 2 turtle doves and a partidge in a pear tree;

etc.

So, by the twelth day I will have received a total of:

12 x 1 partridges (each in a pear tree);

11 x 2 turtle doves;

10 x 3 French hens;

… etc; (until we get to)

1 x 12 drummers drumming.

So, the total number of gifts is:

(12×1) + (11×2) + (10×3) + … + (1×12)

which my abstemious wife very rapidly computed is 364 gifts.

By which time and after a few glasses of wine, I was of course wanting a more general result, so I declared:

*“What about the number of gifts on the Nth day of Christmas?”*

My wife mumbled “here we go!”, and by then my pen and paper napkin were at the ready …

Assuming the general gifts were denoted g1, g2, g3, …, gN, then we’d end up with…

N x 1 of gift g1

(N-1) x 2 of gift g2

(N-3) x 3 of gift g3

… etc. until

1 x N of gift gN

Let’s call the total number of gifts arrived at as G(N). So as an example, we already know that G(12) = 364

In mathematical notation I can write this in a different way (see Note 1), and solve the equation to show that …

**G(N) = (1/6) * N * (N+1) * (N+2)**

Testing this equation for case of N=12 I get

G(12) = (1/6) * 12 * 13 *14

= 2 *13 * 14

= 364

Job done!

When I got home I wondered if there was a geometrical way of deriving this result, rather like the trick that Gauss used as a young boy when the teacher asked the class to add the whole numbers from 1 to 100 (see Note 2).

I rather like the visual proof which I can show for N=4 as:

which generally (for N rather than 4), and expressed algebrailly, can be expressed as

^{N}∑[i] = (N^{2 }– N)/2 + N

= (N^{2 }/2) – N/2 + N

= (N^{2 }/2) + N/2

= (1/2) * N * (N+1)

My question to myself was can we do a similar visual trick with the Nth Days of Christmas sum? (I say we, but without the genius Gauss to assist me!).

We have to go three dimensional now to build a picture of the number. The child’s blocks I could find were too few in number and we don’t have sugar cubes, but we do have veggie stock cubes! So, I created the following …

The left hand portion represents 3×1 + 2×2 + 1×3 which is G(3)

The same number of blocks is in the right portion (in mirror image).

In the middle I have added 1+2+3+4 which is the familiar ^{4}∑[i]

Put these all together and the picture is as follows:

which is clearly 1^{2}+2^{2}+3^{2}+4^{2 }which is the familiar ^{4}∑[i^{2}]

That’s a nice pictorial solution of a kind.

So in algebraic terms that gives

2 G(3) + ^{4}∑[i] = ^{4}∑[i^{2}]

This gives me an algebraic solution that is not any simpler than the original solution I made on the napkin. The stock cubes give me:

G(N-1) = (1/2) * ( ^{N}∑[i^{2}] – ^{N}∑[i] )

which can be solved (Note 3) to give

**G(N) = (1/6) * N * (N+1) * (N+2)**

as before.

However, I felt I had failed in my quest to avoid algebra or at least a much simpler algebraic resolution. Ultimately I couldn’t find one, but the visualization is at least a great way to play with the number relationships.

At least I will be very quick with the answer if ever I am asked

*“How many gifts would you have if you received all the gifts in the general song ‘The N Days of Christmas’?”*

*“Oh, that’s easy, it one sixth of N, times N plus one, times N plus two.”*

Richard W. Erskine, 30th December 2018

**Note 1**

G(N) can be written as the following sum:

G(N) = ∑ [(N – i + 1) * ( i )]

where ^{N}∑[] is shorthand for “sum of expression […] for i ranging from 1 to N”

Expanding the expression, I get

G(N) = ( (N+1) * ^{N}∑[i] ) – ^{N}∑[i^{2}]

Now, there are well known results that give us, firstly

^{N}∑[i] = (1/2) * N * (N+1)

and secondly,

^{N}∑[i^{2}] = (1/6) * N * (N+1) * (2N + 1)

So, combining these I get,

G(N) = ((N+1) * (1/2) * N * (N+1) ) – ((1/6) * N * (N+1) * (2N + 1))

Taking out a common factor (1/6) * N * (N+1), this becomes

G(N) = (1/6) * N * (N+1) * { 3*(N+1) – (2N + 1) }

Simplifying { 3*(N+1) – (2N + 1) } I get {N+2}, so

G(N) = (1/6) * N * (N+1) * (N+2)

**Note 2**

Gauss as a boy spotted a short-cut, which can be seen in the following picture:

The sum 1+2+3+4 is represented by the shaded blocks, and the unshaded blocks are also the same sum in reverse order. So, we can see

1+2+3+4 = (1/2) * 4 * (4+1) = 2 * 5 = 10

and in general

^{N}∑[i] = (1/2) * N * (N+1)

### Note 3

G(N-1) = (1/2) * ( ^{N}∑[i^{2}] – ^{N}∑[i] )

= (1/2) * { { (1/6) * N * (N+1) * (2N + 1) } – {(1/2) * N * (N+1) } }

= (1/2) * (1/6) * N * (N+1) * { (2N + 1) – 3 }

= (1/2) * (1/6) * N * (N+1) * { 2N – 2 }

= (1/6) * N * (N+1) * { N – 1 }

So,

G(N) = (1/6) * (N+1) * (N+2) * N

or, rearranging

**G(N) = (1/6) * N * (N+1) * (N+2)**

as before.