'최소공배수'에 해당되는 글 1건

  1. 2018.11.11 프로젝트 오일러 문제 5
2018. 11. 11. 00:44
728x90

Smallest multiple

Problem 5

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. n은 소수인가?
2. n이 소수라면 20 이하의 가장 큰 n^m을 구해서 결과에 곱한다.
3. 1~2를 20까지 반복

이와 같이 진행하면 결과에는 순서대로 16, 9, 5, 7, 11, 13, 17, 19가 곱해진다.


728x90

'공부 > 문제풀기' 카테고리의 다른 글

프로젝트 오일러 문제 7  (0) 2018.11.11
프로젝트 오일러 문제 6  (0) 2018.11.11
프로젝트 오일러 문제 4  (0) 2018.11.07
프로젝트 오일러 문제 3  (0) 2018.11.04
프로젝트 오일러 문제 2  (0) 2018.11.04
Posted by 아야카