first i have used sieve to store the lowest factor of a number and then using this sieve array i am finding total factors of a number but there is some runtime error.
#include<bits/stdc++.h>
using namespace std;
vector v;
void sieve(){
int a[201];
for(int i=2;i<=200;i++){
if(a[i]==0){
a[i]=i ;
for(int j=i*2;j<=200;j+=i)
if(a[j] == 0)
a[j]=i;
}
}
for(int i=2;i<=200;i++){
int count=0;
int p=i;
while(p!=1){
count++;
p = p/a[p];
}
a[i]=count ;
cout << count << " ";
}
for(int i=2;i<=200;i++){
cout << count << " ";
}
for(int i=2;i<=200;i++)
if(a[i] == 2)
v.push_back(i);
}
//void semiprimes(int n){
// auto it = lower_bound(v.begin(),v.end(),n);
//
// int count = 0 ;
// for(auto it1=v.begin(); it1<it; it1++){
// for(auto j=it1+1; j<it; j++){
// if(*it1+*j == n){
// count =1 ;
// cout << *it1 << " " << *j << endl ;
// break ;
// }
// }
// if(count == 1)
// break ;
// }
// if(count == 1)cout << “YES” << endl ;
// else cout << “NO” << endl ;
//}
int main() {
sieve();
// int t;
// cin >> t ;
// while(t–){
// int n ;
// cin >> n ;
//
// semiprimes(n);
// }
for(auto it=v.begin();it!=v.end();it++)cout << *it << " ";
return 0;
}