• 【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);
                    }
                }
            }

    版权声明:本文为 NoMasp柯于旺 原创文章,如需转载请联系本人。

  • 相关阅读:
    Asp.Net+Oracle+BootStrap+Jquery
    UML类图几种关系的总结
    PHP对象在内存堆栈中的分配
    php sprintf 详解
    微信错误代码45047:客服消息只能发送20条/个用户
    php利用array_search与array_column实现二维数组查找
    mvc 详解
    php中++i 与 i++ 的区分详解
    Git 别名多个命令 超实用
    php 对象继承
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786195.html
Copyright © 2020-2023  润新知