67 lines
1.8 KiB
Markdown
67 lines
1.8 KiB
Markdown
---
|
||
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 --- | --- | --- | --- | --- | --- | --- | --- | --- |