Skip to content

Instantly share code, notes, and snippets.

@anshumanatri
Created March 12, 2009 10:22
Show Gist options
  • Save anshumanatri/78012 to your computer and use it in GitHub Desktop.
Save anshumanatri/78012 to your computer and use it in GitHub Desktop.
void gen_primes()
{
int i,j;
for(i=0;i<MAX;i++) primes[i] = 1;
for(i=2;i<=(int)sqrt(MAX);i++)
if (primes[i])
for(j=i;j*i<MAX;j++) primes[i*j] = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment