freeCodeCamp/guide/chinese/mathematics/all-factors-of-a-number/index.md

67 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: All Factors of a Number
localeTitle: 一个数字的所有因素
---
## 一个数字的所有因素
您可以将因子视为您乘以获得另一个数字的数字。
![](https://upload.wikimedia.org/wikipedia/commons/e/e8/Factor_Tree_of_42.png)
在这种情况下2,3,6和7都是你可以乘以得到42的所有数字。因此它们都是42的因子。但是它们并不是42的所有因素。为了找到所有因素我们可以使用算法或逐步下面的过程。
从1开始。
1 \* 42 = 42
1 | ...... | 42 --- | --- | ---
试试2。
2 \* 21 = 42
1 | 2 | ...... | 21 | 42 --- | --- | --- | --- | ---
试试3。
3 \* 14 = 42
1 | 2 | 3 | ...... | 14 | 21 | 42 --- | --- | --- | --- | --- | --- | ---
试试4。
没有整数可以乘以4得到42所以我们跳过它。
试试5。
没有整数可以乘以5得到42所以我们跳过它。
试试6。
6 \* 7 = 42
1 | 2 | 3 | 6 | ...... | 7 | 14 | 21 | 42 --- | --- | --- | --- | --- | --- | --- | --- | ---
由于6到7之间没有整数所以找到了所有积极因素。上面的所有数字都可以翻转并且将继续成为42的因子。总之42的所有因素都在下面。
1 | 2 | 3 | 6 | 7 | 14 | 21 | 42 | -1 | -2 | -3 | -6 | -7 | -14 | -21 | -42 --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
## 确认因子数是否正确
我们可以通过以下步骤快速确认我们已经确定了所有积极因素:
1. 采用素数分解(由上面的树提供)
2 1 \* 3 1 \* 7 \* 1
2. 为每个指数添加一个:
2的指数1 + 1 = 2 3的指数1 + 1 = 2 7的指数1 + 1 = 2
3. 上面的每个数字都是多个:
2 \* 2 \* 2 = 8
4. 确认42有8个因素
1 | 2 | 3 | 6 | ...... | 7 | 14 | 21 | 42 --- | --- | --- | --- | --- | --- | --- | --- | ---