Created
May 6, 2013 22:55
-
-
Save bl4de/5528930 to your computer and use it in GitHub Desktop.
Sieve of Eratosthenes - 1st implementation in C++ @todo: implement properly - current not work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#define SCOPE 1000 | |
using namespace std; | |
int main() { | |
int tab[SCOPE]; | |
int i = 0; | |
for (i; i < SCOPE; i++) { | |
tab[i] = i; | |
} | |
// sito eratostenesa | |
for (i = 0; i < SCOPE; i++) { | |
if ( tab[i] % 2 == 0 || tab[i] % 3 == 0 || tab[i] % 5 == 0 ) { | |
// to nie jest liczba pierwsza | |
} else { | |
cout << i << endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment