[seqfan] Computing ln(n!) with Bernoulli sequence/stirling's appr

Joe Crump joecr at microsoft.com
Thu Apr 30 16:17:14 CEST 1998

Hi all,

	What is a good (or the best known) way of calculating the
n'th Bernoulli number?

	For reference, or maybe so you can advise me whether my goal
is feasible. I'm trying to compute ln(n!) efficiently, or find out
if it is even possible for n>e^1000.

	I'm currently playing with...

	ln(n!) = (n+1/2) ln n - n + ln(sqrt(2Pi)) + sum(1..threshold, of
(B_k(-1)^(k+1)) / (k(k-1)n^(k-1))

>From Knuth (Fundamental algorithms, pg. 115), where B_k is the k'th Bern.

	But, I'm not sure if this is the best way to go (or off hand how to
compute the n'th Bernoulli numbers efficiently which is why I'm asking you
folks :)).

	Ideally, I'd like to be able to compute ln(n!) results for n
up to (e^1000). That is, compute ln((e^1000)!) with atleast 100-200
digits of accuracy. I'm not sure, without experimenting, whether or not 
the ln(n!) expression above will give enough accuracy without an un-iterable
Bernoulli sequence.

	It seems though that it should be possible to compute. Note that
although n!
is ridiculously huge, it is less than n^n. This implies that ln(n!) is
less than n*ln(n) since ln(n^n)=n*ln(n).

	Any thoughts, suggestions?

  Joseph K. Crump   (Email: joecr at microsoft.com)
  Microsoft Developer Support

If a packet hits a pocket on a socket on a port,
And the bus is interrupted as a very last resort,
And the address of the memory makes your floppy disk abort,
Then the socket packet pocket has an error to report!

What if Dr. Seuss wrote Computer Manuals?

More information about the SeqFan mailing list