/home/toolbox/public_html/solutions/6/686/u.c
1 #include <stdio.h>
2 #include <math.h>
3
4 #define MAX 19000000
5
6 unsigned long long int list1[MAX],list2[MAX];
7 int prime[MAX];
8 void sieve_prime()
9 {
10 int i,j,k,l,m,count=0;
11 unsigned long long int t=0;
12 unsigned long long int serial;
13 for(i=2; i<=MAX; i++)prime[i]=1;
14 k=2;
15 for(m=2; m<=sqrt(MAX); m++)
16 {
17 for(j=k+k; j<=MAX; j=j+k)
18 {
19 prime[j]=0;
20
21 }
22 k++;
23 for(; !prime[k]; k++);
24 }
25 for(i=0; i<=MAX; i++)
26 {
27 if(prime[i])
28 {
29
30 if(prime[i+2])
31 {
32 list1[t]=i;
33 list2[t]=i+2;
34 t++;
35 }
36
37 }
38 }
39
40 }
41
42 int main()
43 {
44 sieve_prime();
45 unsigned long long int serial,n1,n2,u,flag,count;
46 while(scanf("%llu",&serial)==1&&serial!=0)
47 {
48
49 count=0;
50 for(u=2; u<=serial/2; u++)
51 {
52 if(prime[u]==1 && prime[serial-u]==1)
53 {
54
55 count++;
56 }
57
58 }
59 printf("%llu\n",count);
60
61 }
62
63 return 0;
64 }
65