eBash

It is not the mountain we conquer but ourselves

Project Euler Problem 5

| Comments

Table of Contents

1 Problem

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?

2 Solution

可以直接依题意解决,或者稍微用点数学的知识.

我们知道任何大于1的自然数n可以用:

\(n = p_{i}^{a_{i}}p_{i+1}^{a_{i+1}}…p_{j}^{a_{j}}\)

其中 \(p_{i}\) 为素数, \(a_i\) 为幂次.

我们只要找出 k = 20时,其各素数的最高次冥,然后相乘即可.

3 Answer

232792560

Source:C++

Comments