zoukankan      html  css  js  c++  java
  • Problem 7

    Problem 7

    # Problem_7.py
    """
    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?
    第10001个质数是什么?
    质数定义为在大于1的自然数中,除了1和它本身以外不再有其他因数。
    """
    primes = []
    
    for i in range(2, 999999):
        flag = True
        for x in range(2, i):
            if i % x == 0:
                flag = False
                break
        if flag:
            print(i)
            primes.append(i)
        if len(primes) == 10001:
            break
    
    print(primes)
    print(primes[-1])
    Resistance is Futile!
  • 相关阅读:
    php 解析xml
    php
    php 设置自动加载某个页面
    Mac
    mysql
    Git
    C#
    C# 正则表达式
    C# ASCII码排序
    (转)datagridview 自定义列三步走
  • 原文地址:https://www.cnblogs.com/noonjuan/p/10957367.html
Copyright © 2011-2022 走看看