|
|
Line 1: |
Line 1: |
− | Hello, I have a solution to the task 2-34 (TADM2E 2.34) but I have no permissions to created/edit anything.
| |
| | | |
− | Here is the solution:
| |
− |
| |
− | This task refers to this song The_Twelve_Days_of_Christmas_(song).
| |
− |
| |
− | So we have to calculate the sum like this
| |
− |
| |
− | 1 day - 1 gift
| |
− |
| |
− | 2 day - 1 gift + 2 gifts
| |
− |
| |
− | 3 day - 1 + 2 + 3
| |
− |
| |
− | n day - 1 + 2 + 3 + ... + n
| |
− |
| |
− | Formula is
| |
− |
| |
− | <math>
| |
− | \begin{align}
| |
− |
| |
− | &\sum_{i=1}^n \sum_{j=1}^n j\
| |
− | = \sum_{i=1}^n \frac{n(n+1)}{2} =\\
| |
− | &= \frac{1}{2}\sum_{i=1}^n n^2 + \frac{1}{2}\sum_{i=1}^n n=\\
| |
− | &= \frac{n(n+1)(2n+1) + 3n(n+1)}{12} = \frac{(n+1)(n^2+2n)}{6}\
| |
− |
| |
− | \end{align}
| |
− | </math>
| |