Description: Count the number of prime numbers less than a non-negative number, n click to show more hints. References: How Many Primes Are There? Sieve of Eratosthenes Credits:Special thanks to @mithmatt for adding this problem and creating all test…
用python求从1开始第1000个质数? 质数:只能被1和它本身整除的数.那好,我们开始写程序(一个小算法). def calc_prime(prime,num): i,gab=7,2 while num>3: flag=True for x in prime: if x*x>i: break if i%x==0: flag=False break if flag: prime.append(i) if len(prime)>=num: break gab=6-gab i+=gab r…