This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Technically, aren't you using computing to find what ∑ lo g 1 0 n is?
You can approximate it by using integration, to evaluate it as ∫ 1 9 9 4 lo g 1 0 x d x > ∑ lo g 1 0 n > ∫ 1 9 9 3 lo g 1 0 x d x . This gives us 2 5 4 8 . 1 5 > ∑ > 2 5 4 5 . 1 5 . It could be improved slightly by accounting for the first few terms (which give the greatest error). In any case, this gets us close to the answer without much work.
Log in to reply
It can also be done purely analytically without any use of computation by using Stirling's approximation (which gives both a lower and matching upper bound) lo g 1 0 ( n ! ) ≍ 2 1 lo g 1 0 ( 2 π n ) + n lo g 1 0 ( n / e )
hi.shaun well I knew this formula but i still did not understand how you calculated the log of 993! please explain in detail
Log in to reply
it follows as the follwing:
log 4! = log (4
3
3
2
1) = log 4 + log 3 + log 2 + log 1
{as, log (m*n)= log m + log n }
there fore ...
the problem follows the ceiling function.. to get the result of the problem
It should actually be d = ⌊ y ⌋ + 1 . Instead of remembering the formula incorrectly, try to figure out how the formula works. The basic idea is that y = f ( x ) = lo g 1 0 x is strictly increasing on ( 0 , ∞ ) and,
∀ x ∈ Z + , y = f ( x ) = m ∈ Z ≥ 0 ⟺ x = min ( A m + 1 )
where A i denotes the set of all i -digit positive integers ∀ i ∈ Z + .
Is it cheating to use built-in modules? Python solution:
from math import factorial
print len(str(factorial(993)))
Cool! I didn't think of using len and I used log.....
Easy stuff
public class factorialDigits {
public static void main(String[] args) {
BigInteger f = factorial(993);
System.out.println(f.toString().length());
}
public static BigInteger factorial(int n) {
BigInteger prod = BigInteger.ONE;
for (int i = 2; i <= n; i++) {
prod = prod.multiply(BigInteger.valueOf(i));
}
return prod;
}
}
Using Java:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
Which prints out 2 5 4 7
I wrote a code in Python: (http://ideone.com/VebyRT)
1 2 3 |
|
To calculate the value , I just simply used this code in Python-
def f(n):
if n==0:
return 1
return n*f(n-1)
x=str(f(993))
print len(x)
This gave me solution 2547
I did exactly the same ^_^ :D
Python code:
def masba(n):
if n==1:
return 1
else:
return n*masba(n-1)
print len(str(masba(993)))
def fact(i):
if(i==1):
return 1
else:
return i*fact(i-1)
x=fact(993)
i=0
while(x>0):
x//=10
i+=1
print(i)
Problem Loading...
Note Loading...
Set Loading...
To solve this question without computer programming, we take the logarithm of 993 factorial. Since the number of digits of x can be calculated using the formula d = ⌈ y ⌉ + 1 , where d is the number of digits of x and y = lo g 1 0 x . lo g 1 0 9 9 3 ! = n = 1 ∑ 9 9 3 lo g 1 0 n = 2 5 4 6 . 6 1 3 . . .
∴ number of digits in 9 9 3 ! is 2 5 4 6 + 1 = 2 5 4 7 .