Can some one tell why is it not working


#1

vector primesum(int n) {
//start of seive
vectorp(n+1,false);
for(int i=3;i<=n;i+=2)
p[i]=true;
for(int i=3;i<=n;i+=2)
{
if(p[i]==true)
{
for(int j=i*i;j<=n;j+=i)
p[j]=false;
}
}
p[2]=true;
//end of sieve
vectorans;
for(int i=2;i<=n/2;i++)
{
if(p[i]==true && p[n-i]==true)
{
ans.push_back(i);
ans.push_back(n-i);
break;
}
}
return ans;
}