Number of Digits in a FactorialDate: 09/18/2005 at 13:37:48 From: Ryan Subject: Number of digits in a factorial? Is there a way to determine the number of digits that result from a factorial? For instance, 3! = 6 so there is 1 digit. But what about something much larger like 125!? Is there any possible way to tell the number of digits in the answer? Thanks for the reply. Date: 09/18/2005 at 18:38:51 From: Doctor Vogler Subject: Re: Number of digits in a factorial? Hi Ryan, Thanks for writing to Dr. Math. The number of digits in the positive integer x is exactly log(x) + 1, rounded down, where the log is base 10, or you could write ln(x)/ln(10) + 1, rounded down. (Of course, if x is not a perfect power of 10, then this is the same as log(x) rounded up.) Next all you need is a good enough approximation that rounding off gives you the right answer. For that, you can use Stirling's Theorem, Stirling's Approximation http://mathforum.org/library/drmath/view/55996.html Take the log of both the upper and the lower bounds, add 1, and round both down to the nearest integer. If you get the same number on both sides (which you will almost every time), then that's your answer. If you have any questions about this or need more help, please write back and show me what you have been able to do, and I will try to offer further suggestions. - Doctor Vogler, The Math Forum http://mathforum.org/dr.math/ Date: 09/19/2005 at 11:25:41 From: Ryan Subject: Thank you (Number of digits in a factorial?) That works great - thank you very much for your help Doctor Vogler! Cheers, Ryan |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/