版本比较
哥德巴赫的猜想---1+1
正文
增加 17 行删除 17 行
9 行未改动101112131414151617185 行未改动24252627282829303132333434353637383939404142434243444546474849505152535253545556575859606162636364656667686969707171727374757475767778797980818283848384858687878889909119 行未改动9 行未改动#include<bits/stdc++.h>using namespace std;
int main () { __int128 a=4,ji=1e18; //ji,计数器避免程序进入死循环 __int128 a=4,ji=1e18; //ji,计数器避免程序进入死循环 while(ji){ ji-=2; a+=2; }5 行未改动##### 素数判断:```cppint sushu(__int128 w){ if(w < 2) return 0; for(__int128 i=2; i*i <= w; i++){ for(__int128 i=2; i*i <= w; i++){ if(w % i == 0){ return 0; } } return 1;} }```##### 和判断:```cppvoid panduan(__int128 x){ for(__int128 i=2; i < x; i++){ for(__int128 i=2; i < x; i++){ if(sushu(i)){ __int128 o = x - i; if(o >= 2 && sushu(o)){ return; if(o >= 2 && sushu(o)){ return; } } }```
然后把它们合到一起:```cpp#include<bits/stdc++.h>using namespace std; void print(__int128 x) { //看不见看不见~~ using namespace std;void print(__int128 x) { //看不见看不见~~ if (x < 0) { putchar('-'); x = -x; } if (x > 9) print(x / 10); putchar(x % 10 + '0');}int sushu(__int128 w){ if(w < 2) return 0; for(__int128 i=2; i*i <= w; i++){ for(__int128 i=2; i*i <= w; i++){ if(w % i == 0){ return 0; } } return 1;} }void panduan(__int128 x){ for(__int128 i=2; i < x; i++){ for(__int128 i=2; i < x; i++){ if(sushu(i)){ __int128 o = x - i; if(o >= 2 && sushu(o)){ return; if(o >= 2 && sushu(o)){ return; } } }
cout<<"哥德巴赫的猜想不成立,因为"; print(x); cout<<"没有可以分解的2个质数。"; exit(0); } exit(0);}
int main() { __int128 a = 4, ji = 1e18; __int128 a = 4, ji = 1e18; while(ji > 0){ panduan(a); a += 2; ji--;19 行未改动