Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	prime := make([]int, 1000001)
	prime[0], prime[1] = -1, -1
	for i := 2; i < 1000001; i++ {
		if prime[i] != -1 {
			prime[i] = 1 // i means "prime"
			for j := i+i; j < 1000001; j += i {
				prime[j] = -1 // -1 means "not prime"
			}
		}
	}
	for scanner.Scan() {
		ret := 0
		a, _ := strconv.Atoi(scanner.Text())
		if a == 0 {
			break
		}
		for i := 1; i <= a/2; i++ {
			if prime[i] == 1 && prime[a-i] == 1 {
				ret++
			}
		}
		fmt.Println(ret)
	}
}

C++: 
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

#define MAX 100000
#define sqrtMAX sqrt(MAX)

int main(void)
{
  int n;
  vector<int> b(MAX+1);
  vector<int> p(MAX+1);
  vector<int> c(MAX+1);
  int i, j;
  int count;

  // ツエツδ可トツスツテツネツスツづ個づ督づゥツつ「
  b[0] = 1;
  b[1] = 1;
  for(i=4; i<=MAX; i+=2)
      b[i] = 1;
  for(i=3; i<sqrtMAX; i+=2)
      for(j=i+i; j<=MAX; j+=i)
          b[j] = 1;

  // ツ素ツ青板づーツ板イツつォツ出ツつキ
  count = 0;
  for(i=0; i<=MAX; i++) {
    if(b[i])
      continue;
    p[count++] = i;
  }

  for(i=0; i<count; i++) {
    for(j=i; j<count; j++) {
      if(p[i]+p[j] > MAX)
        break;
      c[p[i]+p[j]]++;
    }
  }

  while(scanf("%d", &n)!=EOF) {
    if(n==0)
      break;
    printf("%d\n", c[n]);
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

const int MAX = 1000000;
bool prime[MAX];

void isPrime(){
  fill(prime,prime + MAX,true);
  prime[0] = prime[1] = false;
  rep(i,MAX){
    if(prime[i]){
      for(int j = i + i ; j < MAX ; j += i)
	prime[j] = false;
    }
  }
} 


int main(void){
  isPrime();
  int n ;

  while(cin >> n, n) {
    int ans = 0;
    for(int i = 2; i <= n/2; i++) {
      if(prime[i] && prime[n-i]) ans++;
    }
    cout << ans << endl;
  } 
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    while(cin >> n){
        if(n == 0) return 0;
        vector<bool> F(n + 1, true);
        for(int i = 2; i <= (int)sqrt(n); i++){
            if(F[i]){
                for(int j = i + i; j <= n; j += i){
                    F[j] = false;
                }
            }
        }

        int ans = 0;
        for(int i = 2; i <= n / 2; i++){
            if(F[i] and F[n - i]) ans++;
        }

        cout << ans << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

//??¨????????????????????????
//n??\????????£??´??°????´???°???????????°???????????????is_prime[]???????´?
void eratos(int n, bool is_prime[]) {
	fill(is_prime, is_prime + n + 1, true);
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i*i <= n; i++)
		if (is_prime[i]) {
			int j = i + i;
			while (j <= n) {
				is_prime[j] = false;
				j = j + i;
			}
		}
}

signed main() {
	static bool is_prime[1000010] = {};
	eratos(1000010, is_prime);
	for (int n; cin >> n&&n;) {
		int ans = 0;
		rep(i, 0, n / 2 + 1) {
			if (is_prime[i] && is_prime[n - i])ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>

using namespace std;

int main() {
	vector<int> furui(1000010, 0);
	furui[0] = furui[1] = 1;
	for (int i = 2; i * i < 1000010; i++) {
		if (furui[i] == 0) {
			for (int j = 2; j <= 1000010 / i; j++) {
				furui[i*j] = 1;
			}
		}
	}
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		int counter = 0;
		for (int i = 3; i <= n/2; i+=2) {
			if (furui[i] == 0) {
				if (furui[n-i] == 0) {
					counter++;
				}
			}
		}
		cout << counter << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

const int MAX_N = 1000001;
bool isP[MAX_N];
vector<int> Pri;

int main() {
  {
    fill(isP,isP+MAX_N,true);
    isP[0] = isP[1] = false;
    for(int i = 2; i < MAX_N; ++i) {
      if(!isP[i]) continue;
      Pri.push_back(i);
      for(int j = i*2; j < MAX_N; j += i) isP[j] = false;
    }
  }

  int N;
  while(cin >> N && N) {
    int num = 0;
    for(int i = 0; i < Pri.size() && Pri[i] <= N/2; ++i) {
      if(isP[N-Pri[i]]) ++num;
    }
    cout << num << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
bool isP[1000001];
int N = 1000000;
void make_table(){
  for(int i=0;i<=N;i++)isP[i]=true;
  isP[0]=isP[1]=false;
  for(int i=2;i*i<=N;i++){
    if(isP[i]==false)continue;
    for(int j=i+i;j<=N;j+=i){
      isP[j]=false;
    }
  }
}
int main(){
  make_table();
  int n,sum;
  while(cin>>n&&n){
    sum=0;
    for(int i=0;i<=n/2;i++){
      if(isP[i]&&isP[n-i])sum++;
    }
    cout<<sum<<endl;
  }
  return 0;
}

C++: 
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;
const int MAX_PRIME = 500000;


int prime[MAX_PRIME+1];
bool isPrime[MAX_PRIME+1];
int p;

void erats(){
	// primeツδ環スツトツづーツ渉可甘コツ可サ
	fill(isPrime,isPrime+MAX_PRIME,true);
	p = 0;
	isPrime[0] = isPrime[1] = false;

	for(int i = 2; i <= MAX_PRIME; i++){
		if(isPrime[i]){
			prime[p++] = i;
		}
		else
			continue;

		// ツづ督づゥツつ「ツづ可つゥツつッツづゥ
		for(int j = 2*i; j <= MAX_PRIME; j+=i){
			isPrime[j] = false;
		}
		cout << flush;
	}
}



int main(){
	erats();
	int n;
//	int data[10000100];
	vector<int> data(1000100,0);
	for(int i = 0; i < p; i++){
		//if(prime[i]>(n/2)+1)
		//	break;
		for(int j = i; j < p; j++){
			data[prime[i]+prime[j]]++;
		}
	}
	
	while(cin>>n&&n!=0){
		cout<<data[n]<<endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
bool prime[1000001];
for(int i=2;i<1000001;i++)prime[i]=0;
for(int i=2;i<=sqrt(1000000);i++){
if(prime[i]==0){
for(int j=i+i;j<1000001;j+=i)prime[j]=1;
}
}
int n,cou=0;
while(cin>>n&&n!=0){
for(int i=2;i<=n/2;i++)if(prime[i]==0&&prime[n-i]==0)cou++;
cout<<cou<<endl;
cou=0;
}
}

C++: #include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

int main()
{
  const int MAX_PRIME = 1000000+1;

  bool p[MAX_PRIME];
  memset(p, true, sizeof(p));
  p[0] = p[1] = false;
  for (int i = 2; i*i <= MAX_PRIME; ++i) {
    if (p[i]) {
      for (int j = i+i; j < MAX_PRIME; j += i)
	p[j] = false;
    }
  }

  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    int ans = 0;
    for (int i = 0; i+i <= n; ++i) {
      if (p[i] && p[n-i])
	++ans;
    }
    cout << ans << endl;
  }
  return 0;
}