Computer Science/Algorithm

[Algorithm/C] Project Euler. Smallest multiple

재오니소스 2017. 12. 4. 19:41

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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


// 4 = 2*2 6 = 2*3 8 = 2*2*2 9 = 3 * 3 10 = 2 *5 


// 12 = 2*2*3  14 = 2*2*7  15 = 3*5  16 = 2*2*2*2  18 = 3*3*2  20 = 2*2*5


// 2520 = 2*2*2*5*7*3*3


// result = 2*2*2*5*7*3*3*11*13*2*17*19


이렇게 해서 답은 구했으니 코드로 구현은 시간이 없어서 미완성 ㅠㅠ..