All pastes #552512 Raw Edit

Mirch

public cpp v1 · immutable
·published 2007-06-09 10:02 UTC
rendered paste body
#include <stdio.h>int main (){    int *Primes_list = new int[500];    int Found_primes=0;        bool *Numbers = new bool[10000001];              Primes_list[0]=2;        int j=0;        int i=0;    while (i < 10000001)    {        i++;        Numbers[i]=true;    }        //printf("Bool List Initiated\n");        i=3;    while(Found_primes < 446)    {           //printf("%i \n", i);        while(j <= Found_primes )        {            if(i % Primes_list[j] != 0) { j++; }            //else if( i - Primes_list[j]/2 > 0) break;            else break;                        if( j > Found_primes )            {                  Found_primes++;                  Primes_list[Found_primes]=i;            }        }        j=0;                i = i+2;    }    //printf("First 446 primes found\n");        j=0;    while(j< 446)    {        i=2;        while(i*Primes_list[j] <= 10000000 )        {            Numbers[i*Primes_list[j]]= false;            i++;        }        j++;    }        Numbers[1]= false;    //printf("Sieved 446 prime numbers\n");    /*    i=0;    j=0;    while(i < 10000000)    {        if (Numbers[i] == true)         {             j++;                     }        i++;            }    */    //printf("Theoretical Max Calculus atm %i\n",Primes_list[446]*Primes_list[446]);    //printf("DONE!");    //scanf(" ");    return 0;}