Blue Bridge Cup practice

1 . Up to the least common multiple  

Description of the problem: given a number, please find out from 1 to this number, this range which elected three different numbers, find the least common multiple of these three numbers ,, but here there are many combinations, please find out the total of these combinations, the largest, least common multiple.

Knowledge: the greatest common divisor of the solution method, the greatest common divisor of two numbers * = multiplication least common multiple; (so here we use the Euclidean algorithm determined, the greatest common divisor, and the nature of use, obtained by dividing the least common multiple)

        However, this is different, and at the front and in that, where a plurality of numbers, a method for solving a plurality of numbers: the number obtained by two two, instead of the two numbers, and then iterate until the last number is obtained.

    Property of prime numbers is no common divisor, then two consecutive number, and two consecutive odd divisor is not present, so, if it is odd, the three consecutive multiplying the least common multiple is directly, however, if is even, then the two consecutive numbers, multiplied by the least common multiple is, third number, should the case may be, for example, 242,322, here, there are two 22, 21 and then present the next 3, 20 there are 2, so here compare to search for the least common multiple knew before.

   

Guess you like

Origin www.cnblogs.com/yidiandianwy/p/12088287.html