View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Need code to sum a series

In A1 put in the formula
=Fact(row())

then drag fill it down as far as you wish.

This is your denominator. In an adjacent column (example in B1 put in 1/A1
and drag fill down) You will see that it doesn't take too many rows until
any additional term will be below the precision of the machine to reflect
it. For me,

The 17th term and beyond returns

1.71828182845905

Your series is of the form Sum(1/N-factorial)

--
Regards,
Tom Ogilvy

"davidm" wrote in
message ...

I have been grappling with the algorithm to sum up the following series,
arguably a very awkward one.

1/(1*1) + 1/(1*2) + 1/(1*2*3)+1/(1*2*3*4) + ... + to the 150th term.

It would appear something between a recursive and For/Next construct
might be required but I can't quite get my head around it. Here was my
attempt (using a Function) which failed with Run time "out of stack
space" error.

Function SumSeries(n)
For i = n to 1 step -1
s = s + 1/(i*i-1*Sumseries(i))
Next
SumSeries = s
End Function

Sub test()
Msgbox Sumseries(150)
End Sub


--
davidm
------------------------------------------------------------------------
davidm's Profile:

http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=385467