【Project Euler】7 第七题

简介:


//By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.

//What is the 10 001st prime number?

static void Main(string[] args)
        {
            int count = 0;
            for (int i = 3; i < 1000000; i++)
            {
                int index = -1;
                for (int j = 2; j < i; j++)
                {
                    if (i % j != 0 && i != j)
                    {

                    }
                    else
                    {
                        index += 1;
                    }
                }
                if (index == -1)
                {
                    //Console.WriteLine(i);
                    count += 1;
                }
                if(count==10000)
                {
                    Console.WriteLine(i);
                }
            }
        }

目录
相关文章
|
2月前
Scheduler pelt c program 【ChatGPT】
Scheduler pelt c program 【ChatGPT】
|
6月前
|
Java 测试技术 Maven
Default (Build) 生命周期
Maven的Default(Build)生命周期包括23个阶段,从validate到deploy,涉及源码编译、资源处理、测试、打包和部署等步骤。命令如`mvn compile`只会执行及之前的所有阶段。不同目标与生命周期阶段绑定,适应JAR、WAR、EAR等不同类型项目的构建需求。
|
6月前
|
Apache 调度 数据库
Apache DolphinScheduler VS WhaleScheduler
Apache DolphinScheduler VS WhaleScheduler
645 59
|
6月前
|
Kubernetes 容器
Warning FailedScheduling 14m (x12 over 16m) default-scheduler 0/1 nodes are available: 1 node(s
Warning FailedScheduling 14m (x12 over 16m) default-scheduler 0/1 nodes are available: 1 node(s
119 0
|
算法框架/工具