Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- int n;
- int pp[10000000];
- int num = 0;
- using namespace std;
- int main() {
- cin >> n;
- for (int i = 2; i < n+1; i++) {
- if (pp[i]==0) {
- for (int j = 2*i; j < n+1; j+=i) {
- pp[j]+=1;
- }
- }
- }
- for (int i = 0; i < 10000000; i++){
- if (pp[i]>2){
- cout <<i <<" ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement