jmcgill said:
Is there a method for computing the number of digits, in a given numeric
base, of N factorial, without actually computing the factorial?
Depends on what you mean by 'actually'. So ostensibly, yes, but with a
caveat.
As others have noted, the function you are looking for is simply
floor(log(n!)) + 1 (the # of digits in base b, assuming all logs
base b)
and using Stirling's approximation to the factorial this can be
computed using:
ceiling( (n+1/2) log n - n log e + 1/2 log 2 pi + log(1+ a bunch of
very small stuff))
that last annoying term can be ignored because of the ceiling. (at
least this works numerically for n>=2 for all bases except 2 and 6
where there is only one off by one error each).
The caveat is that in computing logs and e and pi (to enough digits),
one may being enough 'work' that ends up being just as much as needed
to compute the factorial and log in the original (that is, in using the
computation without the explicit use of factorial at the top, there
might be a hidden computation of factorial or, more cryptically, enough
bit manipulations have been performed that are comparable to those
inolved in the original.
To this question, I don't know the answer (I don't know if computing
the log of the factorial is of the same computational complexity as
computing the factorial itself).
An upper bound of O(log log n M(n log n)) (where M is the complexity
of integer multiplication) is given by:
Borwein, Peter B. On the complexity of calculating factorials. J.
Algorithms 6 (1985), no. 3, 376--380
but this says nothing (at least not to me) about the complexity of
computing the log of a factorial.
Mitch