What is the largest n for n!< 1000?

3.5k Views Asked by At

This is simple factorial equation question.

How do you find the largest n satisfying n! < 1000?

(Edit)

Actually, I want to find some other logic other than brute force.

For example,

How about the largest n for $n!<10^{64}$?

2

There are 2 best solutions below

4
On

There is a table of the first factorials at http://www.tsm-resources.com/alists/fact.html that can help you.

2
On

If you are looking for non brute force methods of dealing with factorials, then probably what you want is Stirling's approximation: http://en.wikipedia.org/wiki/Stirling%27s_approximation

However, this approximation is really only helpful for large $n$; in your case, I'd say brute force is the best option.

Personally, I recall that $5! = 120$, after which $6! = 720$, and you know $7! > 1000$.


In response to the edit: To consider when $n!$ exceeds $10^{64}$ is to consider when $n!$ has at least sixty four digits; this sort of question can be broached using Stirling's Approximation combined with a base-$10$ log. Probably you could work this out yourself, but for more details, see here.