Skip to content

Instantly share code, notes, and snippets.

@wowoto9772
Created November 8, 2016 05:01
Show Gist options
  • Save wowoto9772/1b95dc38d2001071048d2e7506a3f3d4 to your computer and use it in GitHub Desktop.
Save wowoto9772/1b95dc38d2001071048d2e7506a3f3d4 to your computer and use it in GitHub Desktop.
for (int i = 2; i*i <= n; i++){
if (!prime[i]){
for (int j = i*i; j <= n; j += i){
prime[j] = true; // prime[j] : false > j is prime
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment