On the basis of freshman’s basic theory, Xiaobai uses the most basic C to write Goldbach’s conjecture

Time:2019-12-1

#include
int main (){

int a,b,c,k,count1,count2;

for(a=4;a<=1200;a=a+2){

for(b=2;b<=a/2;b++){
count1=0;
for(c=2;c<=b-1;c++){
if(b%c==0)
count1++;}
if(count1==0){
k=a-b;
count2=0;
for(c=2;c<=k-1;c++){
if(k%c==0)
count2++;
}
if(count2==0){
printf(“%d=%d+%d\n”,a,b,k);
break;
}

}

}

}

}

 

Recommended Today

Jsonp principle and cross domain implementation

When making the page today, the background gave an interface: https://a.a.com/a/a.json. The online address of my page is: http://b.b.com.Obviously, because of the restriction of browser homology policy, JSON data can’t be obtained through Ajax. Baidu Encyclopedia Homology policy, which is a famous security policy proposed by Netscape. Now all JavaScript enabled browsers will use this […]