#include<stdio.h> #include<math.h> int main() { long num; while(scanf("%ld",&num)==1) { if(num==0) break; long i,j,k,l,m=0,n=0,nn=0; for(i=2;i<=(num/2)+1;i++) { n=0; for(j=2;j<=sqrt(i);j++) { if(i%j==0) n++; } if(n==0) { m=num-i;k=0; for(j=2;j<=sqrt(m);j++) { if(m%j==0) { k++; } } if(k==0) { nn=1; break; } } } if(nn==0) { printf("Goldbach's conjecture is wrong.\n"); } else { printf("%ld = %ld + %ld\n",num,i,m); } } return 0; }
No comments:
Post a Comment