Cool factorials!

Let ξ ( N ) \xi (N) be function that gives number of digits in N ! N! in decimal representation.

Find the value of ξ ( 1000 ) + ξ ( 100 ) + ξ ( 10 ) \xi (1000) + \xi (100) + \xi (10) .


The answer is 2733.

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.

7 solutions

My python code(names of variables are chosen randomly. ) -:

import math

n = 1000

m = 100

k = 10

s = math.factorial(n)

j = math.factorial(m)

k = math.factorial(k)

In = len(str(s))

In1 = len(str(j))

In2 = len(str(k))

print(In + ln1 + ln2)

This could have been solved without resorting to programming.

Miloje Đukanović - 5 years, 7 months ago

Log in to reply

Can you please provide the manual solution?

Aryan Gaikwad - 5 years, 7 months ago
Arulx Z
Nov 21, 2015
1
2
3
4
5
6
import math
def digits(n):
    return int(math.log10(math.factorial(n))) + 1

print digits(1000) + digits(100) + digits(10)
2733

Seems like everyone is using programming to solve this problem. Is there a more mathematical way to solve this problem without relying on computers?

Moderator note:

Using the logarithm of Stirling's formula, an approximation is

ξ n = log 2 π n + n ( log n log e ) log 10 + 1 . \xi n = \lfloor \frac{ \log \sqrt{ 2 \pi n } + n ( \log n - \log e ) } { \log 10 } + 1 \rfloor.

This is correct for most, but not all, values.

Daniel Turizo
Nov 9, 2015

MATLAB Code:

f=@(x)floor(1+sum(log10(x)));
answer=f(1:1000)+f(1:100)+f(1:10);
Alex Li
Mar 30, 2015
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.Scanner;
import java.io.File;
public class x 
{
    public static int digitsFactorial(int x)
    {
        double total = 0;
        for(int i = 1; i <= x; i++)
        {
            total += Math.log10(i);
        }
        return (int) total + 1;
    }
    public static void main(String[] args) throws IOException
    {
        System.out.println(digitsFactorial(10) + digitsFactorial(100) + digitsFactorial(1000));
    }
}

Aryan Gaikwad
Mar 12, 2015

Here is another way to solve it (in Java) -

public static void main(String[] args) throws IOException{
    System.out.println(fact((long) 10) + fact((long) 100) + fact((long) 1000));
}

private static long fact(long n) {
    double logFacN = 0;
    for (long i = 2; i <= n; i++)
        logFacN += Math.log10(i);
    return (long) logFacN + 1;
}
Brock Brown
Mar 8, 2015

Python:

1
2
3
4
from math import factorial
def xi(n):
    return len(str(factorial(n)))
print xi(1000) + xi(100) + xi(10)

Was expecting your python solution @Brock Brown ! Nice sol n ^{n} !!

Harsh Shrivastava - 6 years, 3 months ago

Log in to reply

Thanks. :)

Brock Brown - 6 years, 3 months ago
Vaibhav Prasad
Mar 7, 2015

ξ ( 1000 ) = 2568 \xi(1000) = 2568

ξ ( 100 ) = 158 \xi(100) = 158

ξ ( 10 ) = 7 \xi(10) = 7

2568 + 158 + 7 = 2733 2568+158+7=2733

How did you solve @Vaibhav Prasad

Harsh Shrivastava - 6 years, 3 months ago

Log in to reply

SECRET :D !!!

Vaibhav Prasad - 6 years, 3 months ago

Log in to reply

Okkk!! :) Secret is secret.

Harsh Shrivastava - 6 years, 3 months ago

Log in to reply

@Harsh Shrivastava Harsh try this

https://brilliant.org/problems/go-to-the-floor/?group=QFuwbzryvqgE&ref_id=656258

And also tell me how to add link

Vaibhav Prasad - 6 years, 3 months ago

Log in to reply

Log in to reply

@Harsh Shrivastava got it... now try the problem

Vaibhav Prasad - 6 years, 3 months ago

Log in to reply

@Vaibhav Prasad Got the answer!!

(Answer is a perfect square!!) @Vaibhav Prasad

Harsh Shrivastava - 6 years, 3 months ago

Log in to reply

@Harsh Shrivastava Btw tere exams khatam kya ???

Vaibhav Prasad - 6 years, 3 months ago

Log in to reply

@Vaibhav Prasad 20 ko khatam honge! Social padh liya??

Harsh Shrivastava - 6 years, 3 months ago

Log in to reply

@Harsh Shrivastava mere bhi 20 ko lekin mere start kal ho rahe hai

social mera ho gya merko sanskrit ka dar hai.........

Vaibhav Prasad - 6 years, 3 months ago

Log in to reply

@Vaibhav Prasad Batch formation ke liye kuch padh raha hain kya??

Harsh Shrivastava - 6 years, 3 months ago

Log in to reply

@Harsh Shrivastava exams ke baad start karunga

Vaibhav Prasad - 6 years, 3 months ago

Log in to reply

@Vaibhav Prasad Chal bye , Kal IT hain, padhne jaa raha hun! Tu aur kitne der brilliant pe rahega ??

Harsh Shrivastava - 6 years, 3 months ago

Log in to reply

@Harsh Shrivastava mera bhi IT hai !!

mai bhi thodi der me uth jaunga

Vaibhav Prasad - 6 years, 3 months ago

Did you solved using python?? @Vaibhav Prasad

Harsh Shrivastava - 6 years, 3 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...