|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
| In [[mathematics]], '''trailing zeros''' are a sequence of [[0 (number)|0]]s in the [[decimal]] representation (or more generally, in any [[positional notation|positional representation]]) of a number, after which no other [[Numerical digit|digit]]s follow.
| | They contact me Emilia. Puerto Rico is exactly where he and his wife live. Since she was eighteen she's been operating as a meter reader but she's usually wanted her own business. Body building is one of the issues I adore most.<br><br>Look into my webpage :: std testing at home ([http://javly.com/?p=56362 Suggested Reading]) |
| | |
| Trailing zeros to the right of a [[decimal point]], as in 12.3400, do not affect the value of a number and may be omitted if all that is of interest is its numerical value. This is true even if the zeros [[recurring decimal|recur infinitely]]. However, trailing zeros may be useful for indicating the number of [[significant figure]]s, for example in a measurement. In such a context, "simplifying" a number by removing trailing zeros would be incorrect.
| |
| | |
| The number of trailing zeros in a base-''b'' [[integer]] ''n'' equals the exponent of the highest power of ''b'' that divides ''n''. For example, 14000 has three trailing zeros and is therefore divisible by 1000 = 10<sup>3</sup>. This property is useful when looking for small factors in [[integer factorization]]. [[Binary number]]s with many trailing zero bits are handled similarly in [[computer arithmetic]]. In computer software, the [[count trailing zeros]] operation efficiently determines the number of trailing zero bits in a machine word.
| |
| | |
| ==Factorial==
| |
| The number of trailing zeros in the [[decimal representation]] of ''n''!, the [[factorial]] of a [[non-negative]] [[integer]] ''n'', is simply the multiplicity of the [[prime number|prime]] factor 5 in ''n''<nowiki>!</nowiki>. This can be determined with this special case of [[de Polignac's formula]]:<ref>Summarized from [http://www.purplemath.com/modules/factzero.htm Factorials and Trailing Zeroes]</ref>
| |
| | |
| :<math>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 + \cdots + \left \lfloor \frac{n}{5^k} \right \rfloor, \,</math>
| |
| | |
| where ''k'' must be chosen such that
| |
| | |
| :<math>5^{k+1} > n \ge 5^k,\,</math>
| |
| | |
| and <math>\lfloor a \rfloor</math> denotes the [[floor function]] applied to ''a''. For ''n'' = 0, 1, 2, ... this is
| |
| | |
| :0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 6, ... {{OEIS|A027868}}. | |
| | |
| For example, 5<sup>3</sup> > 32, and therefore 32! = 263130836933693530167218012160000000 ends in
| |
| | |
| :<math>\left \lfloor \frac{32}{5} \right \rfloor + \left \lfloor \frac{32}{5^2} \right \rfloor = 6 + 1 = 7\,</math> | |
| | |
| zeros. If ''n'' < 5, the inequality is satisfied by ''k'' = 0; in that case the sum is [[empty sum|empty]], giving the answer 0.
| |
| | |
| The formula actually counts the number of factors 5 in ''n''<nowiki>!</nowiki>, 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.
| |
| | |
| Defining
| |
| | |
| :<math>q_i = \left \lfloor \frac{n}{5^i} \right \rfloor,\,</math>
| |
| | |
| the following [[recurrence relation]] holds:
| |
| | |
| :<math>\begin{align}q_0\,\,\,\,\, & = \,\,\,n,\quad \\
| |
| q_{i+1} & = \left \lfloor \frac{q_i}{5} \right \rfloor.\,\end{align}</math>
| |
| | |
| This can be used to simplify the computation of the terms of the summation, which can be stopped as soon as ''q<sub> i</sub>'' reaches zero. The condition {{nowrap|5<sup>''k''+1</sup> > ''n''}} is equivalent to {{nowrap|1= ''q''<sub> ''k''+1</sub> = 0.}}
| |
| | |
| == See also ==
| |
| | |
| *[[Leading zero]]
| |
| | |
| ==References==
| |
| <references />
| |
| | |
| ==External links==
| |
| * [http://speleotrove.com/decimal/decifaq1.html#tzeros ''Why are trailing fractional zeros important?''] for some examples of when trailing zeros are significant
| |
| * [http://blog.dreamshire.com/2013/02/20/spoj-problem-11-factorial-fctrl/ ''Number of trailing zeros for any factorial''] Python program to calculate the number of trailing zeros for any factorial
| |
| | |
| [[Category:Elementary arithmetic]]
| |
| [[Category:Zero]]
| |
They contact me Emilia. Puerto Rico is exactly where he and his wife live. Since she was eighteen she's been operating as a meter reader but she's usually wanted her own business. Body building is one of the issues I adore most.
Look into my webpage :: std testing at home (Suggested Reading)