How many trailing zeros will be there after the rightmost non zero digit in the value of 25

Before getting into how to compute trailing zeros of a factorial, first consider where trailing zeros come from.

How many trailing zeros do these numbers have? What's the largest power of ten these numbers are divisible by?

  • 123
  • 18720
  • 6781900
  • 95000
  • 22810000

For the five numbers given, the answers are as follows:

  • 123 has 0 trailing zeros and is not divisible by 10. The highest power of ten it is divisible by is 100=1.10^0=1.
  • 18720 has 1 trailing zero. The highest power of ten it is divisible by is 101=10.10^1=10.
  • 6781900 has 2 trailing zeros. The highest power of ten it is divisible by is 102=100.10^2=100.
  • 95000 has 3 trailing zeros. The highest power of ten it is divisible by is 103=1000.10^3=1000.
  • 22810000 has 4 trailing zeros. The highest power of ten it is divisible by is 104=10000.10^4=10000. □_\square

It's pretty clear that if an integer is divisible by 10k,10^k, then it has kk trailing zeros. Now consider the prime factorizations of integers and how this affects trailing zeros.

How many trailing zeros do these numbers have?

  • 25×542^5 \times 5^4
  • 23×31×54×722^3 \times 3^1 \times 5^4 \times 7^2
  • 21×55×1112^1 \times 5^5 \times 11^1
  • 26×32× 52×131×1722^6 \times 3^2 \times 5^2 \times 13^1 \times 17^2

For the four numbers given, the answers are as follows:

  • 25×54: 2^5 \times 5^4: 242^4 and 545^4 can be combined to make 104.10^4. There are 4 trailing zeros.
  • 23×31×54×72:2^3 \times 3^1 \times 5^4 \times 7^2: 232^3 and 535^3 can be combined to make 103.10^3. There are 3 trailing zeros.
  • 21×55×111:2^1 \times 5^5 \times 11^1: 212^1 and 515^1 can be combined to make 101.10^1. There is 1 trailing zero.
  • 26×32×52×131×172:2^6 \times 3^2 \times 5^2 \times 13^1 \times 17^2: 222^2 and 525^2 can be combined to make 102.10^2. There are 2 trailing zeros. □_\square

In each case, the number of trailing zeros comes from the power of 2 or the power of 5, whichever is smaller. The remaining factors do not matter for trailing zeros. This leads to the following theorem:

If an integer can be expressed as 2a×5b×k2^a \times 5^b \times k, where kk is an integer such that 2∤k2 \nmid k and 5∤k,5 \nmid k, then the number of trailing zeros that integer has is min⁡(a,b).\min(a,b).

This insight becomes important for efficiently finding the number of trailing zeros in factorials. It is sufficient to find the lesser of the powers of 2 or 5, so it is not necessary to count the greater of those powers.

In light of the above theorem, the strategy for finding the trailing zeros of a factorial will revolve around the prime factorization of the factorial.

Give the prime factorization of 10!,10!, and find the number of trailing zeros of 10!.10!.


We have

10!=10×9×8×7×6×5 ×4×3×2 ×1=21×51× 32×23×71× 21×31×51×22 ×31×21,\begin{array}{ccccccccccccccccccccc} 10! & = & 10 & \times & 9 & \times & 8 & \times & 7 & \times & 6 & \times & 5 & \times & 4 & \times & 3 & \times & 2 & \times & 1 \\ & = & 2^1 \times 5^1 & \times & 3^2 & \times & 2^3 & \times & 7^1 & \times & 2^1 \times 3^1 & \times & 5^1 & \times & 2^2 & \times & 3^1 & \times & 2^1, \end{array}

which can be rewritten as

10!=28×34×52×71.10! = 2^8 \times 3^4 \times 5^2 \times 7^1.

The minimum power between 282^8 and 525^2 is 2. Therefore, 10!10! has 2\boxed{2} trailing zeros. □_\square

Consider how in the above example, the power of 2 was much higher than the power of 5. This is the case for all factorials because multiples of 2 show up much more often in the factorial product than multiples of 5. Therefore, it is sufficient to find the power of 5 when computing the trailing zeros of a factorial.

If n!n! can be expressed as 5a×k,5^a \times k, where kk is an integer such that 5∤k,5 \nmid k, then the number of trailing zeros in n!n! is a.a.

Prove that the number of trailing zeros of 6!,7!,8!,9!6!,7!,8!,9! are all the same.


Let nn denote the number of trailing zeros of 6!6!.
Factorizing 6! 6! gives 1×2×3×4×5×6=24×32×51\times2\times3\times4\times5\times6=2^4\times3^2\times5.
Similarly, factorizing 7!,8!,9!7!,8!,9! gives

7!=7×6!=24×32×5×78!=8×7!=24×32×5×7×23 9!=9×8!=24×32×5×7×23× 32.\begin{aligned}7!&=& 7\times6! = 2^4\times3^2\times5\times 7\\ 8!&= &8\times 7! = 2^4\times3^2\times5 \times 7 \times 2^3 \\ 9!&= &9\times 8! = 2^4\times3^2\times5 \times 7 \times 2^3 \times 3^2. \end{aligned}

Because the highest power of 5 that divides 6!,7!,8!,9!6!,7!,8!,9! is 1, they all have the same number of trailing zeros. □ _\square

The strategy now is to count the number of multiples of 5 there are in the factorial product. However, one must also consider that a number in the factorial product can contribute a power of 5 greater than 1.

Find the number of trailing zeros in 30!. 30!.


There are 66 multiples of 5 that are less than or equal to 30. Therefore, there are 66 numbers in the factorial product that contain a power of 5:

30!=30×25×20×15×10×5×k.30!=30 \times 25 \times 20 \times 15 \times 10 \times 5 \times k.

Note that one of these numbers, 25,25, contributes a higher power of 5 to the product. That is, 25=52,25=5^2, while the other 5 multiples contain a 515^1 factor. Therefore, the number of trailing zeros of 30!30! is 7.\boxed{7}. □_\square

Note that each multiple of 5 in the factorial product will contribute 11 to the number of trailing zeros. On top of this, each multiple of 25 will contribute an additional 11 to the number of trailing zeros. Then, each multiple of 125 will contribute another 11 to the number of trailing zeros, and so on.

Find the number of trailing zeros in 500!500!.


The number of multiples of 5 that are less than or equal to 500 is 500 ÷5=100.500 \div 5 =100.
Then, the number of multiples of 25 is 500÷25=20.500 \div 25 = 20.
Then, the number of multiples of 125 is 500÷ 125=4.500 \div 125 = 4.
The next power of 5 is 625, which is greater than 500.

Therefore, the number of trailing zeros of 500!500! is 100+20 +4=124.100+20+4=\boxed{124}. □_\square

As you probably have realized, we can determine the number of trailing zeros of N!N! for any positive integer NN. Do give the following example a try and see if you're able to spot a nice way to express it.

1000!=4023872600770…4720000000…0⏟Plenty of 0’s 1000! = 4023872600770 \ldots 472 \underbrace{0000000 \ldots 0}_{\text{Plenty of 0's}}

The above some of the digits of the 1000!1000!. How many (trailing) zeros are there at the end of this number?


The way to solve this is exactly the same as the previous example:

  • The number of multiples of 5 that are less than or equal to 1000 is 1000÷5=2001000\div5 = 200 .
  • The number of multiples of 25 that are less than or equal to 1000 is 1000÷25=401000\div25 = 40 .
  • The number of multiples of 125 that are less than or equal to 1000 is 1000÷125=81000\div125 = 8 .
  • The only multiple of 625 that is less than or equal to 1000 is 625 itself.

Thus, 1000!1000! has a total of 200+40+8+1=249200 + 40 + 8 + 1 = \boxed{249} trailing zeros.

There's a fancy way to express this strategy using the floor function and logarithms:

Let f(n)f(n) give the number of trailing zeros in the base ten representation of n!n!. Then,

f(n) =∑i=1k⌊n5i⌋ =⌊n5⌋+⌊n52⌋+⌊n53⌋+⋯+⌊ n5k⌋,\begin{aligned} f(n) &= \sum_{i=1}^k \left\lfloor{\frac{n}{5^i}}\right\rfloor \\ \\ &= \left\lfloor{\frac{n}{5}}\right\rfloor+\left\lfloor{\frac{n}{5^2}}\right\rfloor+\left\lfloor{\frac{n}{5^3}}\right\rfloor+\dots+\left\lfloor{\frac{n}{5^k}}\right\rfloor, \end{aligned}

where k=⌊log⁡5n⌋.k=\left\lfloor \log_5{n} \right\rfloor.

Actually, kk could be ∞\infty, but when 5k>n5^k > n, 0 <  n5k < 1 ⟺ ⌊n5k⌋=0,0~<~\frac{n}{5^k}~<~1~\iff~\left\lfloor{\frac{n}{5^k}}\right\rfloor=0, so it does not matter on the main sum.

The first term counts the number of times a multiple of 5 appears in the factorial product, the second counts for multiples of 25, and so on.

Determine the number of trailing zeros of 777!777!.


We plug in 777 to the formula and get

⌊7775⌋+⌊77725⌋+⌊777125⌋+⌊777625⌋=155+31+6+1 =193. □\begin{aligned} \left\lfloor{\frac{777}{5}}\right\rfloor+\left\lfloor{\frac{777}{25}}\right\rfloor+\left\lfloor{\frac{777}{125}}\right\rfloor+\left\lfloor{\frac{777}{625}}\right\rfloor &= & 155+31+6+1 \\ &=&193. \ _\square \end{aligned}

Note that the sequence stopped after ⌊777625⌋\left\lfloor{\frac{777}{625}}\right\rfloor because everything after that would be 0. You don't have to memorize fancy formulas to do this kind of problem consistently, but just know how and why it works.

Find the number of trailing zeros of the number 60!60!.

2015! is multiplied by itself 2015 times as follows:

2015!× 2015!×⋯×2015!⏟2015.\underbrace { 2015!\times 2015!\times\cdots\times 2015! }_{ 2015 }.

Count how many trailing zeros there are!

Determine the number of trailing zeros of 10005!10005!.


We plug in 10005 to the formula and get

⌊100055⌋ +⌊1000525⌋+⌊10005125⌋+⌊10005625⌋+⌊100053125⌋=2001+400+80+16+3= 2500.\begin{aligned} \left\lfloor { \frac { 10005 }{ 5 } } \right\rfloor +\left\lfloor { \frac { 10005 }{ 25 } } \right\rfloor +\left\lfloor { \frac { 10005 }{ 125 } } \right\rfloor +\left\lfloor { \frac { 10005 }{ 625 } } \right\rfloor +\left\lfloor { \frac { 10005 }{ 3125 } } \right\rfloor & = & 2001+400+80+16+3 \\ & = & 2500. \end{aligned}

Note that the sequence would stop after ⌊100053125⌋\left\lfloor{\frac{10005}{3125}}\right\rfloor because everything after that would be 0. So the answer 25002500. □_\square

For how many positive integral values of nn does n!n! end with precisely 23 trailing zeros?

2002!(1001!) 2 \dfrac{2002!}{(1001!)^2}

How many trailing zeroes does the number above have?

An alternative way to compute the trailing zeros of a factorial is given by analyzing the number in a different prime base.

Given an integer nn and prime number p,p, let Sp(n){ S }_{ p }(n) be the sum of digits of nn in base p,p, and let vp (n)v_p(n) be the highest power of pp in n!.n!. Then,

vp(n)=n−Sp(n)p−1. { v }_{ p }(n) = \frac { n - { S }_{ p }(n) }{ p - 1 }.

Find the number of trailing zeros in 452!.452!.


For the formula above, n=452.n=452. Given that this factorial is in base ten, the goal is to find the highest power of 55 in 452!.452!. Therefore, p=5.p=5.

First, it is necessary to compute the number in base 5:

⌊452125⌋ =3452−3⋅125=77⌊7725⌋=377−3⋅25=2 ⌊25⌋=0.\begin{aligned} \left\lfloor \frac{452}{125} \right\rfloor &= 3 \\ 452 - 3 \cdot 125 &= 77 \\ \\ \left\lfloor \frac{77}{25} \right\rfloor &= 3 \\ 77 - 3 \cdot 25 &= 2 \\ \\ \left\lfloor \frac{2}{5} \right\rfloor &= 0. \end{aligned}

Then 45210=33025.452_{10}=3302_{5}.

The sum of the digits of 452 in base 5 is

S5(452)=3+3+0+2=8.S_5(452)=3+3+0+2=8.

Using the formula above, the highest power of 5 in 452!452! is

v5(452)=452−85−1=111. \begin{aligned} v_5(452) &= \frac{452-8}{5-1} \\\\ &= 111. \end{aligned}

Therefore, there are 111\boxed{111} trailing zeros in 452!.452!. □_\square

The process for finding the number of trailing zeros in other prime bases is similar to the process of that in base ten. First, consider what causes a trailing zero in a different number base.

How many trailing zeros do these base-10 numbers have in base 6?

  • 200
  • 756
  • 864

Converting each number to base 6,

20010=5326:0 trailing zeros 75610=33006:2 trailing zeros 86410=40006:3 trailing zeros .\begin{aligned} 200_{10} &= 532_{6}&: &\quad 0 \text{ trailing zeros} \\ 756_{10} &= 3300_{6}&: &\quad 2 \text{ trailing zeros} \\ 864_{10} &= 4000_{6}&: &\quad 3 \text{ trailing zeros}. \end{aligned}

It's clear that trailing zeros in base 10 do not translate to trailing zeros in base 6. As you convert to base 6, you may have noticed that the number of trailing zeros depends on the highest power of 6 that the number is divisible by:

  • The highest power of 6 that 200 is divisible by is 60.6^0. Therefore, there are 0 trailing zeros in base 6.
  • The highest power of 6 that 756 is divisible by is 62.6^2. Therefore, there are 2 trailing zeros in base 6.
  • The highest power of 6 that 864 is divisible by is 63.6^3. Therefore, there are 3 trailing zeros in base 6. □_\square

This principle can be applied to any number base.

If an integer nn can be expressed as ba×k,b^a \times k, where a, b,a,\ b, and kk are integers such that bb is positive, aa is non-negative, and b∤k,b \nmid k, then the number of trailing zeros of nn in base bb is a.a.

This method makes it unnecessary to fully convert the number into the new base in order to count the trailing zeros. This is especially important for computing the trailing zeros of a factorial.

Find the number of trailing zeros of 10!10! in base 12.


We have

10!=10×9×8 ×7×6×5 ×4×3×2×1=21×51×32×23×71× 21×31×51×22 ×31×21,\begin{array}{ccccccccccccccccccccc} 10! & = & 10 & \times & 9 & \times & 8 & \times & 7 & \times & 6 & \times & 5 & \times & 4 & \times & 3 & \times & 2 & \times & 1 \\ & = & 2^1 \times 5^1 & \times & 3^2 & \times & 2^3 & \times & 7^1 & \times & 2^1 \times 3^1 & \times & 5^1 & \times & 2^2 & \times & 3^1 & \times & 2^1, \end{array}

which can be rewritten as

10!=28×34×52×71.10! = 2^8 \times 3^4 \times 5^2 \times 7^1.

Note that 12=22×31.12=2^2\times 3^1. Then,

10!=124×52×71. 10! = 12^4 \times 5^2 \times 7^1.

Therefore, the number of trailing zeros of 10!10! in base 12 is 4.\boxed{4}. □_\square

Note that there is a "bottleneck" of powers of 5 in base 10, but there isn't necessarily a consistent "bottleneck" in other bases. One must consider each prime power in the base when computing the trailing zeros. The method to compute the prime power of a factorial is very similar to the method for base 10:

Let vp(n)v_p(n) give the highest power of pp in n!n!. Then,

vp(n)=∑i=1k⌊npi⌋=⌊np⌋+⌊np2⌋+⌊n p3⌋+⋯+⌊npk⌋,\begin{aligned} v_p(n) &= \sum_{i=1}^k \left\lfloor{\frac{n}{p^i}}\right\rfloor \\ \\ &= \left\lfloor{\frac{n}{p}}\right\rfloor+\left\lfloor{\frac{n}{p^2}}\right\rfloor+\left\lfloor{\frac{n}{p^3}}\right\rfloor+\dots+\left\lfloor{\frac{n}{p^k}}\right\rfloor, \end{aligned}

where k=⌊log⁡pn⌋.k=\left\lfloor \log_p{n} \right\rfloor.

Find the number of trailing zeros of 100!100! in base 45.


Note that 45=32×5.45=3^2 \times 5.

Find the power of 3 3 in 100!:100!:

v3 (100)=⌊1003⌋+⌊1009⌋+⌊10027⌋+ ⌊10081⌋=33+11+3+1=48.\begin{aligned} v_3(100) &= \left\lfloor \frac{100}{3} \right\rfloor + \left\lfloor \frac{100}{9} \right\rfloor + \left\lfloor \frac{100}{27} \right\rfloor + \left\lfloor \frac{100}{81} \right\rfloor \\ &= 33+11+3+1 \\ &= 48. \end{aligned}

The power of 3 in 100!100! is 48, so the power of 9 in 100!100! is 24. Then, 100!=(32 )24×k,100!=\big(3^2\big)^{24} \times k, where kk is an integer such that 32∤k.3^2 \nmid k.

Find the power of 55 in 100!:100!:

v5(100)=⌊1005⌋+⌊ 10025⌋=20+4=24. \begin{aligned} v_5(100) &= \left\lfloor \frac{100}{5} \right\rfloor + \left\lfloor \frac{100}{25} \right\rfloor \\ &= 20+4 \\ &= 24. \end{aligned}

Then, 100!=(32)24× 524×l,100!=\big(3^2\big)^{24} \times 5^{24} \times l, where ll is an integer such that 32∤l3^2 \nmid l and 5∤l.5 \nmid l.

Therefore, 100!100! has 24\boxed{24} trailing zeros in base 45. □_\square

Find the number of trailing zeros in the base-17 representation of 2017!. 2017!.

Clarification: 2017, as it is written here, is in base 10.

Find the smallest integer NN such that when N!N! is written in base 12, it has 121 trailing zeros. Enter your answer in base 6.

How many trailing zeros will be there after the rightmost non

Originally Answered: What will be the last nonzero digit of 123!? 123! ends in 24+4+0=28 zeroes.

How do you find the number of trailing zeros?

A simple method is to first calculate factorial of n, then count trailing 0s in the result (We can count trailing 0s by repeatedly dividing the factorial by 10 till the remainder is 0).

What is the number of trailing zeroes in 22 !?

Number of Trailing Zeros The greatest integer function (usually denoted by brackets) is the rounded down integer of a value. For example, [5] = 5, [4.5] = 4, [-4.5] = -5. For example, the number of trailing zeros in 22! is ([22/5]=4) = 4.

How many zeros does 24 factorial have?

24 factorial has 24 digits. The number of zeros at the end is 4.

How many trailing zeros are there in 26 factorial?

26 factorial has 27 digits. The number of zeros at the end is 6.

How many trailing zeros are there in100?

How many multiples of 25 are between 1 and 100? Since 100 ÷ 25 = 4 there are four multiples of 25 between 1 and 100. => Adding these I get 20 + 4 = 24 trailing zeroes in 100!