Gamma(x+1) (0 <= x <= 39.4)01 STO 0 24 RCL 2
02 . 25 y^x
03 6 26 /
04 y^x 27 STO+ 3
05 1 28 1
06 9 29 STO+ 2
07 * 30 GTO 12
08 STO 1 31 RCL 3
09 0 32 2
10 STO 2 33 SQRTx
11 STO 3 34 LASTx
12 RCL 2 35 /
13 RCL 1 36 /
14 x<=y 37 2
15 GTO 31 38 ENTER
16 x<>y 39 LN
17 2 40 /
18 * 41 RCL 0
19 1 42 1
20 + 43 +
21 RCL 0 44 y^x
22 y^x 45 /
23 2 46 GTO 0012.12 R/S => 648,976,950.1 after 3.5 seconds (HP-12C+)
On the 15C,
12.12 x! => 648,976,950.9
This is based on the following approximation I've come up with:
Gamma(x+1) ~ SUM(k=0,inf,(2*k+1)^x/2^k)/(sqrt2/2*(2/ln(2))^(x+1))
Obviously, this is not the proper way to compute the Gamma function. It's just an example of what can be done on the fast 12C+. Just for an idea, it would take about 7 minutes to compute Gamma(40) on a normal 12C using this method.
Gerson.
--------------
The approximation is being used reversely, that is, it is meant to approximate
this integer sequence, not the Gamma function:
an ~ n!/(2*sqrt2)*(2/ln(2))^(n+1)
I found it when thinking about John Smitherman's math joke turned into a problem. The numbers 2, 6, 34, 294... (which showed as the problem was getting progressively more complex) ought to mean something... I couldn't find it at OEIS but I found 1, 3, 17, 147..., the halved sequence. Eventually I found out the original sequence is the row sums of Sierpinski-Pascal-MacMahon triangle, whatever this might be.
Next time someone starts a joke I'll try to just laugh, as everybody else :-)
I just intended to put a computationally intensive programming problem to the 12C+ to see how it performed. For computing Gamma function on the 12C+ or the normal 12C and 12c Platinum there isn't anything better than Egan Ford's program:
http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv016.cgi?read=100275
See message #6.
Edited: 26 June 2009, 10:30 a.m.