#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#define M 33000
using namespace std;
bool prime[M];
int main(){
for(int i = 2; i <= sqrt(M); i++)
if(prime[i] == 0)
for(int j = i+i; j < M; j += i)prime[j] = 1;
int n;
while(cin >> n){
if(n == 0)break;
int m = 0, x, y;
for(int j = 2; j < n; j++)
if(!prime[j] && !prime[n-j])
if((j > 1 && j <= (n/2)) && ((n-j) > 1 && (n-j) >= (n/2)))m++;
cout << m << endl;
}
return 0;
}
#include <cstdio>
#include <vector>
#include <cmath>
#define M 33000
using namespace std;
bool prime[M];
int main(){
for(int i = 2; i <= sqrt(M); i++)
if(prime[i] == 0)
for(int j = i+i; j < M; j += i)prime[j] = 1;
int n;
while(cin >> n){
if(n == 0)break;
int m = 0, x, y;
for(int j = 2; j < n; j++)
if(!prime[j] && !prime[n-j])
if((j > 1 && j <= (n/2)) && ((n-j) > 1 && (n-j) >= (n/2)))m++;
cout << m << endl;
}
return 0;
}
No comments:
Post a Comment