Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void mark (long[] a, int l, int r)
- {
- int i_sqrt_max = (int)Math.Sqrt(r*2) / 2 + 2;
- for (int k = 1; k <= i_sqrt_max; k++) //from 1 because multiples of a[0]=2 aren't in the array
- {
- if (a[k] != 0)
- {
- for (long i = a[k]+k; i < r; i += a[k])
- //where do I have to start i (in relation to l,k) to avoid repeating the steps from i to l?
- {
- a[i] = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement