I am on a quest to determine the 13th term in
Sloane's (OEIS) A229024, a sequence that I recently authored. This sequence is all about calculating
Total[IntegerDigits[n!] for a reasonably large subset of contiguous n. For the 13th term, n is in the vicinity of 182623000, the factorial of which has more than 1.4*10^9 decimal digits. It takes some 20 minutes for Mathematica to return on my system the sum of the digits of one such n!, so it will take me many months to chart the roughly 15000 sums that I think need to be done. Unfortunately, I am finding that for a random, roughly-2% of the n that I try, Mathematica returns an erroneous result. For example, I get for
Total[IntegerDigits[182616009!]] a value of 1600311191. I know that this sum is incorrect because it is not evenly divisible by 9. (It is also significantly smaller than the sum of digits for nearby n-factorial. It appears that
IntegerDigits[182616009!] introduces more than a billion
additional trailing zeros preceding the 45653996 trailing zeros that I expect.) I've reported the bug to Wolfram in the hope that this will be fixed in some future version, assuming of course that it is not my system that is responsible. So what procedure can I use to get a
correct value for
Total[IntegerDigits[182616009!]] in the interim? I thought to use
DigitCount[182616009!] but
Total[RotateRight[DigitCount[182616009!]]*Range[0, 9]] results in the identical incorrect value as before.