diff options
author | Ta180m | 2020-05-02 21:29:36 -0500 |
---|---|---|
committer | Ta180m | 2020-05-02 21:29:36 -0500 |
commit | 642183438c3de2ea1fc630c845492a1dfd77323e (patch) | |
tree | 585555df1e1ed3cd561896cb7ad97d9cde05244f /Math | |
parent | 797b463ad18778bee16b2a985419012be0d7164a (diff) |
Update primes.cpp
Diffstat (limited to 'Math')
-rw-r--r-- | Math/primes.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Math/primes.cpp b/Math/primes.cpp index acbe0cf..3420fe1 100644 --- a/Math/primes.cpp +++ b/Math/primes.cpp @@ -1,8 +1,9 @@ -constexpr int sieve_size = 1e7; -bitset<sieve_size + 1> bs; +int sieve_size; +bitset<10000001> bs; vector<int> pr; -void sieve() { +void sieve(int size) { + sieve_size = size + 1; bs.set(); bs[0] = bs[1] = 0; for (ll i = 2; i < sieve_size; ++i) if (bs[i]) { for (ll j = i * i; j < sieve_size; j += i) bs[j] = 0; |