The Museum of HP Calculators

HP Forum Archive 09

[ Return to Index | Top of Index ]

Factorials of Large Numbers
Message #1 Posted by Gordon Dyer on 20 Nov 2002, 5:41 p.m.

I posted an HP-11C/41C program in the Software Library (it's now the first entry) and asked for feedback from anyone who has a real use for this...where n! >= 1E100
Any one got any news for me?

(And for those smart guys with HP-71 or newer calcs with number range up to 1E500, same applies to you but for >= 1E500 !)
Gordon.

      
Re: Factorials of Large Numbers
Message #2 Posted by Bill Wiese on 25 Nov 2002, 10:05 p.m.,
in response to message #1 by Gordon Dyer

Hi...

Whoa, this brings back memories of a 'wasted' summer in high school (1980?) tinkering with my ol' TI58! (Didn't get my 41C til Christmas in my senior year - and then fooling w/system architecture/SP/ byte jumping etc took over...)

Wrote various "big factorial" programs, including log(n!) programs and approximations.

Stirling's Approx. works progressively better for larger and larger values of n, but has to be 'warped' for moderately useful performance for, say, n<69.

n! ~= sqrt(2*pi*n) * (n/e)^n and log(n!) ~= 0.5*log(2*pi*n) + n*log(n/e)

Anyway I still remember that 10,000!~= 2.645x10^35659 and 1,000!~= n.nnnx10^2567 100!~= 9.332x10^157...

Nifty little thing: Number of trailing zeros of n!: Trailing zero = multiple of 10. We have an excess of factors of two in a factorial (after all, every other number is even!) so every term in factorial that has a 5 or power thereof determines a trailing zero.

Thus:

int(n/5)+int(n/25)+int(n/125)+int(n/625)+int(n/5^5)...

gives us number of trailing zeros in n! . 1000! has, IIRC, 249 trailing zeros and 10,000! has 2499 trailing zeros.

Factorials are neat. Remember finding out about companion gamma function (I *knew* there must be something continuous over n>=0 for something factorial-like.)

That was a fun summer...

Bill Wiese San Jose, CA

            
Re: Factorials of Large Numbers
Message #3 Posted by Gordon Dyer on 7 Dec 2002, 12:43 p.m.,
in response to message #2 by Bill Wiese

Hi Bill, I'm glad you enjoyed my message.
Did you try the program?
I was beginning to think that no one was interested!

Perhaps I should ask for the prog to be posted in the HP-41 software section and more people would look at it.
Best Wishes.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall