Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
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
Template HeapSort
project
find duplicate in O(n)
Defining Class Members
Dar
XML parsing with regex
Dar
floyd alfa 1
hh
Addition of two matrix **Part 2