#include <stdio.h>

int prime[1000010]={1, 1, };

void Prime() {
    for(int i=2; i<=1000; i++) {
        if(prime[i]==0) {
            for(int j=i*i; j<=1000000; j+=i) prime[j]=1;
        }
    }
}

int main() {
    Prime();

    int cnt=0;
    for(int i=2; i<=1000000; i++) {
        if(!prime[i]) {
            printf("%6d ", i); cnt++;
            if(cnt%15==0) puts("");
        }
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: