Suppose that we have a very large factorial such as (10^7)!, Is there an efficient way to count its exact digits? (Wolfram alpha result says (10^7)! has 65,657060 digits)
Of course, I can't use the naive implementation by successively multiplying the value one by one since it will be too slow to evaluate the result.
I think the solution to this question might ended up in either
- How to find the digit of the factorial without calculating the factorial
- How to compute the factorial more efficiently (BigInteger or BigDecimal is preferable)
I would prefer 1. rather than 2. since I just want to know how many digits of the factorial. Any suggestion?