Invitation to Computer Science 8th Edition

Published by Cengage Learning
ISBN 10: 1337561916
ISBN 13: 978-1-33756-191-4

Chapter 3 - Exercises - Page 139: 2b


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.

Work Step by Step

Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.