Why not 2015?

Find the sum of all positive integers n n such that n ! n! ends with precisely 2016 2016 zeros.


The answer is 40385.

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.

4 solutions

To make a zero, we need the factors 2 2 and 5 5 . Since we will have more factors of 2 2 than 5 5 in any n ! n! calculation we need focus only on the factors of 5 5 .

Now in general there are x k = n k x_{k} = \lfloor \frac{n}{k} \rfloor multiples of k k less than or equal to n n for any integer k . k. To find all the factors of 5 5 in n ! n! we will need to find

m = 1 x 5 m \sum_{m=1}^{\infty} x_{5^{m}} , i.e., x 5 + x 25 + x 125 + . . . . . . x_{5} + x_{25} + x_{125} + ...... .

We thus need to find all n n such that this sum comes to 2016. 2016.

Next, note that for n = 3125 n = 3125 this sum comes to 781 781 and for n = 15625 n = 15625 this sum comes to 3906. 3906. So we are looking for values of n n between these two values. Thus our sum will only involve a calculation of x 5 + x 25 + x 125 + x 625 + x 3125 . x_{5} + x_{25} + x_{125} + x_{625} + x_{3125}.

For a first estimate, look at the sum without the floor function, i.e.,

n 5 + n 25 + n 125 + n 625 + n 3125 = 2016 \dfrac{n}{5} + \dfrac{n}{25} + \dfrac{n}{125} + \dfrac{n}{625} + \dfrac{n}{3125} = 2016

781 n 3125 = 2016 n = 8066.58... \Longrightarrow \dfrac{781*n}{3125} = 2016 \Longrightarrow n = 8066.58...

As the least n n we are looking for will be a multiple of 5 5 , we will need to make the sum calculations for multiples of 5 5 near to this initial estimate. For n = 8070 n = 8070 we get a sum of 2014 2014 , and for n = 8075 n = 8075 we get the desired sum of 2016. 2016. As the smallest k k -value in our sum is 5 5 , we know that the next four integers after 8075 8075 will yield a sum of 2016 2016 as well.

Thus the desired solution is 8075 + 8076 + 8077 + 8078 + 8079 = 40385 . 8075 + 8076 + 8077 + 8078 + 8079 = \boxed{40385}.

Note that there are no n n such that n ! n! ends in precisely 2015 2015 zeros, hence the title of this question.

Solved it the same way! Just wondering is there a better method for doing this so we get that n=8075 instead of getting 8066.5 right off the bat? Pls tell me

Maninder Dhanauta - 5 years, 10 months ago

Log in to reply

Yes, we can use langrage's principle i.e., e p ( n ) = n S p ( n ) n 1 { e }_{ p }(n) = \frac { n - { S }_{ p }(n) }{ n - 1 } , where e p ( n ) { e }_{ p }(n) is the highest power of p p in n n and S p ( n ) { { S }_{ p }(n) } is the sum of the digits of n n in base p p .

Priyanshu Mishra - 5 years, 7 months ago

Did it by the same way

saptarshi dasgupta - 5 years, 3 months ago
Sourav Chaudhuri
May 25, 2015

The highest power of 5 thats contained in this number has to be the answer. Now with the number approaching 2016 that becomes a little imposing initially. What I did was some approximation to land close to the number As this is a sum of increasingly restrictive values, we are looking for a number which leads us close to the vicinity of 2016. Since this method focuses on the trial and error bit, thus a reasonable number to start with was 8000 as 8000/5 = 1600 and 8000/25 = 320 which together adds upto 1920 which gets us within reasonable proximity of 2016. A common technique, though not foolproof that I have observed which helps in such cases would be to focus on the numbers which are essentially multiples of 5(again not a fail safe method, it has glaring inadequacies). Proceeding this way we can arrive at 8075 with maybe 3-4 rounds of calculations.

Now, if any number n is chosen that has k zeroes at the end of n! then the next 4 numbers also will be ending with the same number of zeroes because its not until the next multiple of 5 does the number of zeroes change.

Any inputs are welcome

Shanuj Garg
Aug 9, 2015

n=0

l=0

for i in range(0,10000,5):

l=i

n=0

while( l > 0):

    n = n + l/5

    l=l/5

if (n == 2016):

     print 5*i+10

python code for the problem

Ashwin K
Feb 11, 2016

To continue with this solution, I would like to say that this was a handy method for me.

We have to see no of 5's in the given number to be exactly 2016.

Let us consider a smaller number. For instance 5! = 5/5 = 1 which has only 1 0.

This continues but for 25! = 25/5 = 5/5 =1 which has 6 0's.

That is for multiple of 25,we will get a jump.

But for 125 = 125/5 = 25/5 =5/5 =1 has 31 0's.

We need to see the series 125,250,375,...

We know that 31(65) = 2015.

But 1250, 2500, 3250, 5000, 6250, 7500 each carries an extra 0 in them.

65th term = 125 + 64(125) = 65(125) = 8125 will have 8125/5 = 1625/5 =325/5 = 65/5 = 13/5 = 2 will have 2030 0's.

we get 8075 having 2016 0's if we check it.

The next 5 numbers will have exactly 2016 0's...8075...8079

Total is 40385.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...