Re: Early calculators that could do x! for x > 69 ? Message #13 Posted by Bart (UK) on 26 May 2010, 5:34 p.m., in response to message #12 by Bart (UK)
OK, so this got me thinking, how to do a factorial using this "feature" on the SR7919. Just doing simple 1*2*3... doesn't help much of course and only gets to 70 and is error-prone (I think human error increases as the tediousness of repetition increases).
So, in my search, Wikipedea was my friend and on their factorial page I found the following approximation by Srinivasa Ramanujan:
LN(n!) = n*LN(n) - n + (LN(n(1+4n(1+2n))))/6 + (LN(pi))/2
So all I have to do is calculate the right hand side (let's call it RHS) , and do e^x, except that the SR7919 doesn't do exponent overflow for the e^x function. The most complex function it does so for is x^2. Now I can see those cogs in your minds already at work and before you have finished reading this sentence, worked out that SQR(n!)=e^(RHS/2) then do x^2 and -voila!- I have n! up to n=120. Some results:
n SR7919 HP-20S
70 1.1978 E00 1.1978572 E100
99 9.3327 E55 9.3326215 E155
120 6.6894 E98 6.6895029 E198 These are just a few sample points and accuracy may differ more at other points.
My next "challenge" - to find the least number of keystrokes to do this :).
(And why a 20S for comparing? It happened to be laying on the table and is capable of E499)
Edit: I used the 20S built-in n! function, whose accuracy I don't know either. It only accepts integers, so is not a Gamma aprroximation though.
Edited: 26 May 2010, 5:57 p.m.
|