第5题: 最小倍数
Problem 5: Smallest Multiple
目录
题目
最小倍数
$2520$ 是可以被 $1$ 至 $10$ 中的每一个数整除的最小数。
求能被 $1$ 至 $20$ 中的每一个数整除的最小正整数。
Smallest Multiple
$2520$ is the smallest number that can be divided by each of the numbers from $1$ to $10$ without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from $1$ to $20$?
解题方法
显然,答案为 $1$ 至 $20$ 中的每一个数进行素因数分解后,取最大的次方并相乘。
对 $1$ 至 $20$ 分解素因数见下表:
- | 2 | 3 | 5 | 7 | 11 | 13 | 17 | 19 |
---|---|---|---|---|---|---|---|---|
1 | ||||||||
2 | 1 | |||||||
3 | 1 | |||||||
4 | 2 | |||||||
5 | 1 | |||||||
6 | 1 | 1 | ||||||
7 | 1 | |||||||
8 | 3 | |||||||
9 | 2 | |||||||
10 | 1 | 1 | ||||||
11 | 1 | |||||||
12 | 2 | 1 | ||||||
13 | 1 | |||||||
14 | 1 | 1 | ||||||
15 | 1 | 1 | ||||||
16 | 4 | |||||||
17 | 1 | |||||||
18 | 1 | 2 | ||||||
19 | 1 | |||||||
20 | 2 | 1 | ||||||
最高次方 | 4 | 2 | 1 | 1 | 1 | 1 | 1 | 1 |
因此答案为 $ 2^{4} * 3^{2} * 7 * 11 * 13 * 17 * 19$
参考代码
|
|