conty911 wrote:
Bunuel wrote:
NUMBER THEORY
Trailing zeros:
Trailing zeros are a sequence of 0's in the decimal representation (or more generally, in any positional representation) of a number, after which no other digits follow.
125000 has 3 trailing zeros;
The number of trailing zeros in the decimal representation of n!, the factorial of a non-negative integer \(n\), can be determined with this formula:
\(\frac{n}{5}+\frac{n}{5^2}+\frac{n}{5^3}+...+\frac{n}{5^k}\), where k must be chosen such that \(5^k<n\).
It's easier if you look at an example:
How many zeros are in the end (after which no other digits follow) of \(32!\)?
\(\frac{32}{5}+\frac{32}{5^2}=6+1=7\) (denominator must be less than 32, \(5^2=25\) is less)
Hence, there are 7 zeros in the end of 32!
The formula actually counts the number of factors 5 in n!, but since there are at least as many factors 2, this is equivalent to the number of factors 10, each of which gives one more trailing zero.
I noticed in case the number (n) is multiple of \(5^k\) and we have to find number of trailing zero zeroes, then it will be \(5^k<=n\) rather \(5^k<n\)
no of trailing zeros in 25! =6
\(\frac{25}{5}+\frac{25}{5^2}= 5+1\);
Please correct me, clarify if i'm wrong. Thanks
The highest power of a
prime number "k" that divides any number "n!" is given by the formula
n/K + n/k^2+n/k^3.. (until numerator becomes lesser than the denominator). Remember to truncate the
remainders of each expressionE.g : The highest number of 2's in 10! is
10/2 + 10/4 + 10/8 = 5 + 2 + 1 = 8 (Truncate the reminder of each expression)
As a consequence of this, the number of zeros in
n! is controlled by the presence of
5s. Why ? 2 reasons
a) 10 = 5 x 2,
b) Also in any n!, the number of 5's are far lesser than the number of 2's.
Think about this example.
The number of cars that you make depends on the number of engines. You can have 100 engines and 1000 cars, but you can only
make 100 cars (each car needs an engine !)
10 ! = 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1
Lets factorize each term ...
10! = (5 x 2) x(3x3)x(2x2x2)x7x(2x3)x(5)X(2x2)x1
the number of 5s = 2
The number of 2s = 7
The number of zeros in 10! = the total number of 5s = 2 (You may use a calc to check this
10! = 3628800)
hence in any n! , the number of
5's control the number of zeros.As a consequence of this, the number of 5's in any n! is
n/5 + n/25 + n/125 ..until numerator becomes lesser than denominator.
Again, i want to emphasize that this formuala
only works for prime numbers !! So to find the number of 10's in any n!, DO
NOT DIVIDE by 10 ! (10 is
not prime !)
i.e DONT do
n/10 + n/100 + n/1000 - THIS IS WRONG !!!