- Trailing zero
In
mathematics , trailing zeros are a sequence of 0s in thedecimal representation (or more generally, in any positional representation) of a number, after which no otherdigit s follow.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 recur infinitely. However, trailing zeros may be useful for indicating the number ofsignificant figure s, for example in a measurement. In such a context, "simplifying" a number by removing trailing zeros is 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 = 103. This property is useful when looking for small factors ininteger factorization .Binary number s with many trailing zero bits are handled similarly incomputer arithmetic .Factorial
The number of trailing zeros in the
decimal representation of "n"!, thefactorial of anon-negative integer "n", can be determined with this formula: [Summarized from [http://www.purplemath.com/modules/factzero.htm Factorials and Trailing Zeroes] ]:
where "k" must be chosen such that
:
and ⌊"a"⌋ denotes the
floor function applied to "a".For example, 53 > 32, and therefore 32! = 263130836933693530167218012160000000 ends in
:
zeros. If "n" < 5, the inequality is satisfied by "k" = 0; in that case the sum is empty, giving the answer 0.
The formula actually counts the number of factors 5 in "n"!, but since there are at least as many factors 2,this is equal to the number of factors 10, each of which gives one more trailing zero.
Defining
:
the following
recurrence relation holds::
This can be used to simplify the computation of the terms of the summation, which can be stopped as soon as "q i" reaches zero. The condition nowrap|5"k"+1 > "n" is equivalent to nowrap|1= "q" "k"+1 = 0.
References
External links
* [http://www2.hursley.ibm.com/decimal/decifaq1.html#tzeros "Why are trailing fractional zeros important?"] for some examples of when trailing zeros are significant
* [http://www.medscape.com/viewarticle/503274 Mu and Trailing Zero] – a case where trailing zeros are deprecated.
Wikimedia Foundation. 2010.