• 【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柯于旺 原创文章,如需转载请联系本人。

  • 相关阅读:
    centos 7.5 snmp 安装
    centos 7.5 telnet 离线安装
    使用httpClient发送请求(支持https)
    kafka基本概念
    List根据时间字符串排序
    mac安装yosys遇到`dyld: malformed mach-o image`报错
    ctags的--exclude选项
    每周分享(3)
    实践OKR极易出现的四大误区
    从OKR小白到成功落地OKR(三)
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786195.html
Copyright © 2020-2023  润新知