## Invitation to Computer Science 8th Edition

364 gifts --- This time our task is to sum up all the gifts given over the 12 days. What we know for sure is the amounts of gifts given on each $n^{t h}$ Day using the previously mentioned formula: $\frac{n \cdot(n+1)}{2}$ But in this case, the amount of gifts in each following day does not increase by 1 or 2 or any fixed integer as we have seen in previous exercises. In this case, we can't use the same formula. But we can use the Hint provided: $1 \cdot(2)+2 \cdot(3)+3 \cdot(4)+\ldots+n \cdot(n+1)=\frac{n \cdot(n+1) \cdot(n+2)}{3}$ The only difference is that this formula considers the amount of gifts on any $n^{t h}$ Day to be $n \cdot(n+1),$ while in our case it is $\frac{n \cdot(n+1)}{2} .$ So we only need to divide the Hint formula by $2$ and plug in $12$ for $n :$ $\frac{n \cdot(n+1) \cdot(n+2)}{3 \cdot 2}=\frac{n \cdot(n+1) \cdot(n+2)}{6}=\frac{12 \cdot(12+1) \cdot(12+2)}{6}=\frac{12 \cdot 13 \cdot 14}{6}= 364$ This is how we know there have been $364$ gifts given over all $12$ days.