1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Size of x!

  1. Jan 27, 2009 #1
    is there a way to determine (does not need to be exact) the number of digits in x! ?

    sorry if this is kind of pointless
  2. jcsd
  3. Jan 27, 2009 #2


    User Avatar
    Science Advisor
    Gold Member

    For large n, use Stirling's formula:

    n! ~ (2[pi]n)1/2 (n/e)n
  4. Jan 27, 2009 #3


    User Avatar
    Science Advisor
    Homework Helper

    O(x log x).

    To be more precise, x log x - x log e + O(log x), where the base of the logarithms is the base you want to express the number.
  5. Jan 27, 2009 #4

    Gib Z

    User Avatar
    Homework Helper

    Don't forget to then apply

    [tex]D = 1 + \lfloor \log_{10} \lfloor n! \rfloor \rfloor [/tex]

    after that for the number of digits.
  6. Jan 28, 2009 #5


    User Avatar
    Science Advisor

    If [tex]n![/tex] is hard to calculate, the series

    [tex]D = 1 + \lfloor \sum^n_{i=1} \log_{10}i \rfloor[/tex]

    should be easier to calculate - for integer [tex]n[/tex].
  7. Jan 28, 2009 #6

    Gib Z

    User Avatar
    Homework Helper

    Depends how large n is. If it's quite large, calculating logs for each term up to it may not be easier than using Stirlings Formula which simplifies into something that doesn't look that bad after a log anyway. But that definitely is a good idea =]
  8. Jan 28, 2009 #7
    Anyone know of a way to get an answer just to a certain precision in mathematica?
    I do no mean truncating the answer, but more the way a person would, so for example,
    1/"insert incredibly long hard to calculate mess here" as zero, or instead of getting the inside of a natural log to hundreds of decimal points, just get it to 10 or so.
    is there a way to do that?
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Size of x!
  1. Derivative x^x^x (Replies: 7)

  2. Solve x^x=x (Replies: 7)

  3. X^x^x^x^x = 2 (Replies: 2)

  4. X+(∞)+(-∞) = x? (Replies: 5)