diff --git a/math/primes_up_to_10^8.cpp b/math/primes_up_to_billion.cpp similarity index 79% rename from math/primes_up_to_10^8.cpp rename to math/primes_up_to_billion.cpp index db9b56cab..d8f5a9f9d 100644 --- a/math/primes_up_to_10^8.cpp +++ b/math/primes_up_to_billion.cpp @@ -1,12 +1,12 @@ -#include #include +#include char prime[100000000]; void Sieve(int64_t n) { memset(prime, '1', sizeof(prime)); // intitize '1' to every index - prime[0] = '0'; // 0 is not prime - prime[1] = '0'; // 1 is not prime + prime[0] = '0'; // 0 is not prime + prime[1] = '0'; // 1 is not prime for (int p = 2; p * p <= n; p++) { if (prime[p] == '1') { for (int i = p * p; i <= n; i += p) @@ -15,7 +15,6 @@ void Sieve(int64_t n) { } } - int main() { Sieve(100000000); int64_t n;