Returns the smallest positive integer that can be divisible by numbers ranging from 1 to 20. The most intuitive method is to obtain the minimum public multiple of the 20 numbers from 1 to 20. Evaluate the minimum public multiples of n numbers. take the numbers a, B, and c as an example. Their minimum public multiples are equal to: first obtain the minimum public multiples m of a and B, then the minimum public multiples of m and c are the minimum public multiples of three numbers.
Returns the smallest positive integer that can be divisible by numbers ranging from 1 to 20. The most intuitive method is to obtain the minimum public multiple of the 20 numbers from 1 to 20.
Evaluate the minimum public multiples of n numbers. take the numbers a, B, and c as an example. Their minimum public multiples are equal to: first obtain the minimum public multiples m of a and B, then the minimum public multiples of m and c are the minimum public multiples of three numbers.
Evaluate the minimum public multiples of two numbers a and B. first extract the larger one, such as a, and then use k * a to test whether the smaller one can be divisible, k is the natural number k * a starting from 1
Int get_lcm (int a, int B) {if (a = B) {return a;} int bigger =
Another better method is to take n as an example.
2, 3, 4, 5, 6, 7, 8, 9, 10 (1 does not make any sense, ignore it)
Decompose these numbers into prime factors:
2, 3, 2*2, 5, 2*3, 7, 2*2*2, 3*3, 2*5
These prime numbers are 2, 3, 5, and 7 respectively.
The final answer can be expressed:
2 ^ a * 3 ^ B * 5 ^ c * 7 ^ d (where, x ^ y indicates the power y of x)
The English letters indicate the maximum number of times the prime factor appears in the expression obtained when the prime factor is decomposed.
Prime factor 2 appears three times at most in 8 = 2*2*2, so a is 3.
Similarly, we can get 2 ^ 3*3 ^ 2*5 ^ 1*7 ^ 1 = 2520.
This article is available at http://www.nowamagic.net/librarys/veda/detail/939.