I originally thought it boiled down to

1+2+...+11+12=78

But now that I think about it again, I'm pretty sure I was wrong.  The 
correct sequence is:

(1) + (1+2) + (1+2+3) + ... + (1+2+...+11+12)

Which I think makes you right.

Sam


Matt Filizzi wrote, On 6/18/2007 12:19 PM:
> Wouldn't it be this...
>
> gifts = 0
> (1..12).each do |x|
>  (1..x).each do { |y| gifts += y }
> end
>
> puts gifts
>
> Note the difference between mine and yours,  where I count each item 
> instead
> of each set.  So 5 gold rings counts as 5 instead of 1.  I think it all
> depends on how the original question was intended.
>
> On 6/18/07, Sammy Larbi <sam / powersource.com> wrote:
>>
>> I'm not sure why you'd want to, but I suppose you could do something 
>> like:
>>
>> gifts=0
>> (1..12).each do |i|
>>     (1..i).each { |j| gifts += 1 }
>> end
>> puts gifts
>>
>> danielj wrote, On 6/18/2007 11:50 AM:
>> > There is a song that goes like this:
>> >
>> >     On the first day of Christmas, my true love sent to me a partridge
>> > in a pear tree.
>> >     On the second day of Christmas, my true love sent to me two turtle
>> > doves and a partridge in a pear tree.
>> >     ...
>> >
>> > If this goes on for the 12 days of Christmas. How many presents will
>> > your true love send you over Christmas?
>> > <strong>(Hint: You will need a loop inside another). </strong>
>> >
>> > I don't think you need a loop inside a loop.... Here is what I did:
>> >
>> > day = 0
>> > gifts = 0
>> >
>> > 12.times do
>> >  day = day + 1
>> >  gifts = gifts + day
>> > end
>> >
>> > print gifts
>> >
>> > Does anyone know how you would do it with a <em>loop inside a loop</
>> > em>?
>> >
>> >
>> >
>> >
>> >
>>
>>
>>
>