Quote:

Out of context (i.e. calculator nerd bashing), I found it quiet funny. Especially because I got a calculator for Christmas and then proceeded to write a Gamma function for it. Details here: http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv018.cgi?read=145337#145337.

Egan, in original 12C post you use the following to approximate the factorial:

x! = x^x*sqrt(2PIx)*e^(1/[12x + 2/(5x + 5/4x)] - x)

Very elegant, with simple constants, and seems to work pretty well--indeed for calculator use with limited steps it is hard to get much better, especially if you use the shift-divide correction for the smaller arguments.

But I notice that it is a slight variation of a Stieltjes continued fraction. (stieltjes3 at Peter Luschny's site is the analagous formula.) The only difference is that in the version I know and which I can find on on Viktor Toth's site, the innermost term is actually 53/(42x).

I am curious whether you made the choice to approximate 53/42 by 5/4 yourself, or did you see another version of the formula on an earlier version of Viktor's site? I have to admit that deciding on the slight modification of that term is very wise, especially on the 10C and 12C where every digit is a keystroke.

I am kind of preoccupied myself with computing gamma on calculators that don't have it for noninteger values, so I am curious on the provenance of the formula you chose. (Right now I am experimenting with a variation of the Windschitl formula, but I think it takes more steps without any huge improvement in accuracy. With a 10 or 12 digit calculator, rounding error becomes significant quickly and mitigates the benefit of adding too many correction terms!)

Les