欧拉筛
1 void sd() 2 { 3 int sum=0; 4 for (int i = 2; i <= 100000; i++) 5 { 6 if (p[i] == false) 7 s[sum++] = i; 8 for (int j = 0; j < sum; j++) 9 { 10 if (i * s[j] > 100000) 11 break; 12 p[i * s[j]] = true; 13 if (i % s[j] == 0) 14 break; 15 } 16 } 17 }