//Answer=5777
int cprime(int x)
{
int n=2;
int p=0;
if(x==1){return 0;
}
while(n<=x/2)
{
if(x%n==0)
{
p++;
}
n++;
}
if(p==0){return 1;}
else{return 0;}
}
main()
{
int store=0;
int y=9;
while(y<=10000)
{
store=0;
int n=0;
int power=1;
int k=2;
while(k<y)
{
if(y%k==0&&((y%2)!=0))
{
while((pow(power,2)*2)<y)
{
n=0;
int res=(power*power*2);
int t=y-res;
n=cprime(t);
if(n==1){
store=power;
}
power++;
}
if(store==0){printf("Answer=%d",y);exit(0);}
break;
}
k++;
}
store=0;
y++;
}
}
int cprime(int x)
{
int n=2;
int p=0;
if(x==1){return 0;
}
while(n<=x/2)
{
if(x%n==0)
{
p++;
}
n++;
}
if(p==0){return 1;}
else{return 0;}
}
main()
{
int store=0;
int y=9;
while(y<=10000)
{
store=0;
int n=0;
int power=1;
int k=2;
while(k<y)
{
if(y%k==0&&((y%2)!=0))
{
while((pow(power,2)*2)<y)
{
n=0;
int res=(power*power*2);
int t=y-res;
n=cprime(t);
if(n==1){
store=power;
}
power++;
}
if(store==0){printf("Answer=%d",y);exit(0);}
break;
}
k++;
}
store=0;
y++;
}
}
No comments:
Post a Comment