0

Given that $$\begin{aligned} f(1)&=\text{partridge in a pear tree}\\ f(2)&=\text{turtle doves}\\ f(3)&=\text{French hens}\\ f(4)&=\text{calling birds}\\ f(5)&=\text{golden rings}\\ f(6)&=\text{geese a-laying}\\ f(7)&=\text{swans a-swimming}\\ f(8)&=\text{maids a-milking}\\ f(9)&=\text{ladies dancing}\\ f(10)&=\text{lords a-leaping}\\ f(11)&=\text{pipers piping}\\ f(12)&=\text{drummers drumming} \end{aligned}$$ formulate the lyrics to the song The Twelve Days of Christmas in summation form for maximum compactness.

__

Note

This question is posted under the tag "recreational mathematics" in the spirit of festive cheer.

  • 1
    I'm afraid I don't understand the question. How are you supposed to include the "On the first day of Christmas..." and other bits like that? Or do you not want to include them (as an answer below seems to have interpreted)? – Wojowu Dec 23 '16 at 17:47
  • 3
    By the way, this seems like it'd be suited perfectly for Programming Puzzles & Code Golf SE. – Wojowu Dec 23 '16 at 17:48
  • @Wojowu - You can formulate another function for that - that's the idea :) – Hypergeometricx Dec 23 '16 at 17:49
  • @Wojowu - Thanks for the suggestion. Perhaps it might find a more friendly response there! – Hypergeometricx Dec 23 '16 at 18:02
  • @Wojowu - Your suggestion has received three upvotes. I would not mind posting the the same question there, but would not want downvotes/being put on hold for being a cross-platform duplicate. What are your views? Views from anyone or moderators also welcome. – Hypergeometricx Dec 27 '16 at 14:34

3 Answers3

2

$$\sum_{i = 1}^{12} \sum_{j = 1}^i jf(j)$$

I believe that gives you everything that you would end up with over the twelve days.

To get the lyrics, you would want

$\sum_{i = 1}^{12}$"On the $i$-th day of Christmas my true love gave to me" + $\left( \sum_{j = -i}^{-1} -j + f(-j) \right)$

1

Throughout the tune, we receive 12 partridges in pear trees, 22 turtle doves, 30 french hens, etc. So to total everything up, I think this sum is more compact: $$\sum_{n=1}^{12}(13-n)f(n)$$

0

Define $$g(n)=\text{On the }n\text{-th day of Christmas my true love gave to me}$$ and the operator $\circ$ as the concatenation of two text strings.

The lyrics of the song can then be represented as $$\color{red}{\boxed{\sum_{n=1}^{12} g(n)\circ \sum_{m=1}^n (n+1-m)\circ f(n+1-m)}}$$

Note: To avoid confusion, the operator $\circ$ has been defined and used.

  • 1
    how does the distributive law of multiplication work when applied to song lyrics? (sarcasm). I believe my edited answer below gives the same thing, using addition rather than multiplication. – setholopolus Dec 23 '16 at 17:59
  • @setholopolus - Thank you for you solution and comment (and sarcasm :)) The logic for multiplication is that one is counting the number of objects (e.g. $2f(2)$) and not adding them. Anyway, as my comment on your post said, it's debatable, and I've upvoted your answer. In the spirit of festive cheer, as always. – Hypergeometricx Dec 23 '16 at 18:15