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}$?
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}$?
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.
There is a table of the first factorials at http://www.tsm-resources.com/alists/fact.html that can help you.
50! = 3.0414 x 10^64 Factorials are defined for positive integers. Stirling's formula happens to give excellent results for factorials (n=positive integer). But it also works for positive non-integers. However, non-integers aren't factorials. It's interesting that 0! is defined as being equal to 1. This is necessary for calculating probabilities.
Greg Schaffer