What a long, strange trip it’s been.
(Grateful Dead)
In this final post, I explore a curious (at least from my perspective), yet tenuous, relationship between triangular numbers and the polynomial model, from parts 4 and 5 respectively, via a brief detour through Calculus.
As a reminder, the function to compute the Nth triangular number from part 4 is shown below along with the sum of the applications of this function to the values (day number) 1 to 12:
The function to compute the number of gifts for the Nth day of Christmas from part 5 is:
and as we saw in the last post, applying this function to 12 also gives 364:

If we take the indefinite integral of the triangular numbers function, the result is as follows:
The first term of the resulting integral is the same as the polynomial.
The coefficients of the second terms differ (one half vs one quarter) between the polynomial model and the integral of the triangular numbers formula.
Ignoring the constant of integration, C (see below), this gives:
which is 40 short of what all our methods give for the number of gifts for the 12 days of Christmas. Since we are interested in the range of days from 1 to 12, the result of applying this formula to 1 should be subtracted, giving f(12) – f(1) = 324 – 0.41666 = 323.58333.
A more intuitive way to understand and compute the integral of this function is via a numerical method called the Riemann Sum, in which rectangles are used to approximate the area under the curve (which is what the integral means here):
As the number of rectangles increases and their width decreases, the Riemann Sum result becomes closer to the Actual Sum. Making a = 0 instead adds nothing since f(0) here gives 0.
Geogebra was used to create the Riemann Sum graphic above in which the actual area computed by the so-called definite integral is also shown. The definite integral, F, for the 12 days of Christmas does allow us to ignore C, owing to the fact that subtracting the application F to 1 from the application of F to 12 cancels C out :
As you can see, this result is the same as the Actual Area shown in the Geogebra graphic above.
So, my intuition that integrating the triangular numbers equation would give the same result as the days-of-xmas equation, and the polynomial equation in particular, turned out to be wrong. But, there’s a simple reason for that. The derivative (opposite of the integral) of the polynomial equation is not the triangular numbers equation! It is this instead:
If we apply the Riemann Sum to this, we should get the expected result:
Note that the final term (one third) does make a contribution here since f(0) is non-zero.
So ends the long strange trip down the rabbit hole this series has taken me on.
Or does it?
I’ve spent far too much time thinking about this, but it’s been a lot of fun!
Or have I?
Definitely mathematics of the recreational kind anyway!








