#include <stdio.h>
// 0 1 2 3 4 5
// 1 1 0 0 1 0 ...0이면 소수
int num[1000001]={1,1,0};
//무슨 체
int main() {
//소수인 수 찾기, i가 소수면 i배수 다 지움
for(int i=2; i*i<=1000000; i++) {
if(num[i]==0) {
for(int j=2; i*j<=1000000; j++) {
num[i*j]=1;
}
}
}
while(1) {
int n;
scanf("%d",&n);
if(n==0) break;
int is_gold=0;
for(int i=3; i<=n/2; i+=2) {
if(num[i]==0 && num[n-i]==0) {
printf("%d = %d + %d\n",n,i,n-i);
is_gold=1;
break;
}
}
if (is_gold==0) printf("Goldbach's conjecture is wrong.\n");
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: