首页 | 主题 | 图库 | 问答 | 文摘 | 原创 | 百科

历史 | 地理 | 人物 | 艺术 | 体育 | 科学 | 音乐 | 电影 | 信息技术 | 世界遗产

 开放、中立,源自维基百科

Personal tools

Trailing zero

From Wikipedia, the free encyclopedia

  (Redirected from Trailing zeros)
Jump to: navigation, search

In mathematics, trailing zeros are a sequence of 0s in the decimal representation (or more generally, in any positional representation) of a number, after which no other digits 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 of significant figures, 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 in integer factorization. Binary numbers with many trailing zero bits are handled similarly in computer arithmetic.

Factorial

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:[1]

Failed to parse (Missing texvc executable; please see math/README to configure.): 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 \,,

where k must be chosen such that

Failed to parse (Missing texvc executable; please see math/README to configure.): 5^{k+1} > n\,,

and ⌊a⌋ denotes the floor function applied to a.

For example, 53 > 32, and therefore 32! = 263130836933693530167218012160000000 ends in

Failed to parse (Missing texvc executable; please see math/README to configure.): \left \lfloor \frac{32}{5} \right \rfloor + \left \lfloor \frac{32}{5^2} \right \rfloor = 6 + 1 = 7\,

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

Failed to parse (Missing texvc executable; please see math/README to configure.): q_i = \left \lfloor \frac{n}{5^i} \right \rfloor\,,

the following recurrence relation holds:

Failed to parse (Missing texvc executable; please see math/README to configure.): \begin{align}q_0\,\,\,\,\, & = \,\,\,n\quad, \\ q_{i+1} & = \left \lfloor \frac{q_i}{5} \right \rfloor\,.\end{align}

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 5k+1 > n is equivalent to q k+1 = 0.

References

  1. ^ Summarized from Factorials and Trailing Zeroes


External links

AD Links