Quote:
Originally Posted by Hamlet53
Not my place at all to pose a question, but since for the moment this seems to be in a interlude to discuss golf . . .
When I see series like this I am always interested in a general formula. So suppose instead of 12 days, your true love gives you 365 days of gifts, under the same sort of progression. First day one gift, second day two gifts and repeat of the first day gift, etc. How many total gifts at the end?
This is not the official question so do not let it interrupt the next in line.
|
Rambling real-time working out of formula in spoiler tags for brevity.
Spoiler:
OK, the way to work it out is like this:
On the 1st day you get 1
On the 2nd day you get 2 + 1
On the 3rd day you get 3 + 2 + 1
.
.
On the nth day you get n+(n-1)+...+1
Now the sum n+(n-1)+...+1 = n(n+1)/2
So to get the total we need to add up
1*2/2, 2*3/2, 3*4/2, ... , n(n+1)/2
Obviously the factor of two is common, so we can simplify to
(1*2 + 2*3 + 3*4 + ... + n*(n+1))/2
Which looks complex, and we'll make it more complex still by remembering the general formula for each term and expanding that.
((1*1+1) + (2*2+2) + (3*3+3) + .... + (n*n + n))/2
But now we can split it into two sequences
((1*1) + (2*2) + (3*3) + .... (n*n))/2 + (1 + 2 + 3 + ... + n)/2
Now the second bit is just n(n+1)/4 (we used the same formula above).
And there is a formula for the sum of squares, so the first bit is just n(n+1)(2n+1)/12 (Proof of the sum of squares formula can be found
here.)
So the total number of presents for any n days is
n(n+1)(2n+1)/12 + n(n+1)/4 which simplifies to
n(n+1)(2n+4)/12 which simplifies to:
n(n+1)(n+2)/6
A remarkably pleasing result, which could probably be derived more simply.
Check for 12: 12*13*14/6 = 364.
So for 364 days: 364*365*366/6 = 8,104,460