Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Christmas Math Fun
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00064933
Message ID:
00064995
Views:
38
>>>On the 1st day of Xmas, my true love gave to me:
>>>1 item
>>>On the 2nd day of Xmas, my true love gave to me:
>>>2 items + 1 item
>>>On the 3rd day of Xmas, my true love gave to me:
>>>3 items + 2 items + 1 item
>>>.
>>>.
>>>On the n-1 day of Xmas, my true love gave to me:
>>>n-1 items + n-2 items + ... + 1 item
>>>On the nth day of Xmas, my true love gave to me:
>>>n items + n-1 items + ... + 1 item
>>>
>>>How many total items did my true love give to me, as a function of n?
>>
>>Looks like the Summation of k for k=1 to n. Solution to this is
>>
>>( n * ( n + 1 ) ) / 2
>
>Er, not exactly. That gets you the number of items on the nth day. What we're seeking is the sum as described above, where each day is cumulative from previous days. Day 3, you get 6+3+1=10 items for example, all the items from days 1, 2 , and 3...(Like the twelve days of Xmas) :~)

Bill's solution works. On day 3, n=3 so [3 * ( 3 + 1)] / 2 = 6 which is 3+2+1. Day 4, (4 * 5)/2 = 10, or 4+3+2+1 = 10.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform