Most efficient code for the first 10000 prime numbers?

前端 未结 30 1490
日久生厌
日久生厌 2020-11-29 19:09

I want to print the first 10000 prime numbers. Can anyone give me the most efficient code for this? Clarifications:

  1. It does not matter if your code is ineffici
30条回答
  •  感动是毒
    2020-11-29 19:28

    Here the code that I made :


    enter code here
    #include 
    #include 
    #include 
    #include 
    #include 
    using namespace std;
    
    
    int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT*/   
    
    unsigned long int n;
    
    int prime(unsigned long int);
    
    scanf("%ld",&n);
    
    unsigned long int val;
    
    for(unsigned long int i=0;i

提交回复
热议问题