Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
- vector<bool>is_prime(1000000,true);
- int main()
- {
- int i,j,n;
- for(i=2; i<=sqrt(1000000); i++)
- {
- if(is_prime[i])
- {
- for(j=i*i; j<=1000000; j+=i)
- is_prime[j]=false;
- }
- }
- while(scanf("%d",&n))
- {
- if(n==0)
- break;
- for(i=3; i<n/2+1; i+=2)
- {
- if(is_prime[i])
- {
- if(is_prime[n-i])
- {
- printf("%d = %d + %d\n",n,i,n-i);
- break;
- }
- }
- }
- if(i>n/2+1)
- printf("Goldbach's conjecture is wrong.\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement