Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Sieve of Eratosthenes
//g++ 4.9.3 #include <iostream> int main() { const int MAX_NUMBER = 10000000; bool is_prime[MAX_NUMBER + 1]; std::fill(is_prime, is_prime + MAX_NUMBER + 1, true); is_prime[0] = is_prime[1] = false; for (int i = 4; i < MAX_NUMBER + 1; i += 2) { is_prime[i] = false; } for (int i = 3; i < MAX_NUMBER + 1; i += 2) { if (is_prime[i]) { for (int j = 2 * i; j < MAX_NUMBER + 1; j += i) { is_prime[j] = false; } } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Pruebas estocasticos
Ploshtina na krug
execution of constructor and destructor
weird cast in qt moc files
HI
Discounting Future Stream
Finalproject
Policy based smart pointer
typename T class T
Dar
stackse - search stackoverflow differently
Please log in to post a comment.