//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?
static void Main(string[] args)
{
for(int j=1;j<1000000000;j++)
{
int count = 0;
for(int i=1;i<21;i++)
{
if(j%i==0)
{
count += 1;
}
}
if(count==20)
{
Console.WriteLine(j);
}
}
}
版权声明:本文为 NoMasp柯于旺 原创文章,未经许可严禁转载!欢迎访问我的博客:http://blog.youkuaiyun.com/nomasp
本文探讨了如何找出能被1至20所有数字整除的最小正整数,通过迭代检查每个数字是否能被1到20的所有数字整除,直至找到符合条件的最小数。
138

被折叠的 条评论
为什么被折叠?



