Can anyone please help me to understand the "Segmented Seive"?I have tried myself as i can do enough to get it but unfortunately still now i don't catch it. Thanks in advance!
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 170 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 160 |
5 | djm03178 | 158 |
5 | -is-this-fft- | 158 |
7 | adamant | 155 |
8 | Dominater069 | 154 |
9 | awoo | 153 |
10 | luogu_official | 152 |
Can anyone please help me to understand the "Segmented Seive"?I have tried myself as i can do enough to get it but unfortunately still now i don't catch it. Thanks in advance!
Name |
---|
Let the segment is from left to right.
At first you should generate the set of prime numbers from 1 to sqrt(right).
Now you can get the first number divisible by a prime number p in the segment by this equation St = ((l + p - 1) / p) * p (ceil) Now someone can mark the numbers divisible by p the same way used in normal sieve.