Please help me with this ques i was trying it for all nos but as the question says the fr5action cant be reduced i have become clueless please explain the solution as well my logic fails to address the problem of condition that the fraction can’t be reduced any further
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
map<int,int>mp;
int arr[n+1]={0};
int sum=1;
for(int i=2;i<=n;i++){
// cout<<"\n";
int num=i;
for(int j=2;jj<=i;){
while(num%j==0){
mp[j]++;
// cout<<mp[j]<<endl;
sum/=mp[j];
sum=(mp[j]+1);
// cout<<j<<" "<<sum<<endl;
num/=j;
}
if(j==2)j++;
else j+=2;
}
if(num>=2){
mp[num]++;
sum/=mp[num];
sum*=(mp[num]+1);
// cout<<mp[num]<<endl;
num/=num;
}
// for(auto c:mp){
// sum*=(c.second+1);
// }
arr[i]=(sum)/2+arr[i-1];
}
cout<<arr[n]<<endl;
return 0;
}