Goldbach conjecture 4 is greater than any one of said even number can be removed and the two odd primes, there are multiple groups, a given n,
Ask whether there is a group of odd prime satisfying the above, when more than one set of differencing largest group
n ∈ [6,1e6]
# Explanations
Pretreatment all prime numbers, all in addition to the two primes are all odd, it can Laid-off determination, determining a prime number, it is determined by np is prime to
From small to large prime number enumeration to ensure that the maximum difference
1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=1e6+10; 4 int p[N],cnt; 5 bool st[N]; 6 int n; 7 void get_primes(int n){ 8 for(int i=2;i<=n;i++){ 9 if(!st[i]) p[cnt++]=i; 10 for(int j=0;p[j]<=n/i;j++){ 11 st[p[j]*i]=true; 12 if(i%p[j]==0) break; 13 } 14 } 15 } 16 int main(){ 17 get_primes(N); 18 while(cin>>n,n){ 19 for(int i=1;i<cnt;i++){ 20 int a=p[i]; 21 int b=n-a; 22 if(!st[b]){ 23 printf("%d = %d + %d\n",n,a,b); 24 break; 25 } 26 27 } 28 } 29 }