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++: /*1000000ÈºÌfÅüÍµ½nÈºÌÅåÌfðoÍ·évO*/
#include <iostream>
const int MAX = 1000001;
const int P_NUM = 78498;
using namespace std;

bool p[MAX];
int a[79000]={};

void f(){
    for(int i=0 ; i<MAX ; i++){
        p[i] = (i<=1)? false : true ;
    }
    for(int i=2 ; i*i<= MAX+1 ; i++){
        if( p[i] ){
            for(int j=i*2 ; j<MAX ; j+=i){
                p[j] = false;
            }
        }
    }
	for(int i=2,j=0; i<MAX ; ++i ){
		if(p[i])
			a[j++] = i;
	}
}

int main(){
    int n;

    f();

    while( cin >> n , n ){
		int ans = 0;
		int pos;
		for(pos = 0 ; n > a[pos] ; ++pos );

		for(int i=0 ; i<=pos ; ++i ){
			int x = n-a[i];
			if( p[x] && x >= a[i] )
				ans++;/*
			for(int j=pos ; j>=i ; --j ){
				if( a[i]+a[j] == n ){
					ans++;
					continue;
				}
				if( a[i]+a[j] < n ){
					continue;
				}
			}*/
		}
		cout << ans << endl;
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
#define MAX 1000005
bool isPrime(int n){
  for(int i=2;i*i<=n;i++) if(n%i==0) return false;
  return true;
}
int main(){
  int n;
  bool d[MAX]={};
  for(int i=2;i<MAX;i++) d[i]=isPrime(i);
  while(cin>>n,n){
    int ans=0;
    for(int i=2;i<=n/2;i++){
      if(d[i]&&d[n-i]) ans++;
    }
    cout << ans << 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]=false;
  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=2;i<n;i++){
      if(isP[i]&&isP[n-i])sum++;
    }
    cout<<sum<<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(100010, 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 <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int MAX_N = 1000001;

vector<int> p;
bool isp[MAX_N];
int ans[MAX_N];

void make_prime(){
  REP(i, MAX_N) isp[i] = true;
  isp[0] = isp[1] = false;
  FOR(i, 2, MAX_N){
    if(!isp[i]) continue;
    p.push_back(i);
    for(int j = i + i; j < MAX_N; j += i) isp[j] = false;
  }
}

int main() {
  make_prime();
  memset(ans, 0, sizeof(ans));
  REP(i, p.size()) FOR(j, i, p.size()) if(p[i] + p[j] < MAX_N) ++ans[p[i] + p[j]];
  int N;
  while(cin >>N && N) cout <<ans[N] <<endl;
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

bool isPrime[1000000];
int primes[1000000];
int primeSize = 0;
int main()
{
	fill(isPrime, isPrime+1000000, true);
	for (int i = 2; i < 1000; ++i)
	{
		if (isPrime[i])
		{
			for (int j = 2*i; j < 1000000; j += i)
				isPrime[j] = false;
		}
	}
	for (int i = 0; i < 1000000; ++i)
		if (isPrime[i])
			primes[primeSize++] = i;

	int n;
	while (scanf("%d", &n), n)
	{
		int ans = 0;
		for (int i = 0; primes[i] <= n/2; ++i)
			if (isPrime[n - primes[i]])
				++ans;
		printf("%d\n", ans);
	}

	return 0;
}

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

#define MAX 1000000
#define sqrtMAX sqrt(MAX)

int main(void)
{
  int n;
  vector<int> b(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;

  while(scanf("%d", &n)!=EOF) {
    if(n==0)
      break;
    count = 0;
    for(i=0;i<=n/2;i++)
      if(!b[i]&&!b[n-i]) count++;
    printf("%d\n", count);
  }
  return 0;
}

C++: #include <iostream>
#define MAX 1000000

using namespace std;

int isprime[MAX];

void ERATOSUTENESUNOHURUI(void){

  for( int i = 0 ; i < MAX ; i++ ) isprime[i] = 1;
  isprime[0] = isprime[1] = 0;

  for( int i = 2 ; i*i < MAX ; i++ ){
    if( isprime[i] ){
      for( int j = i+i ; j < MAX ; j += i ){
	isprime[j] = 0;
      }
    }
  }

}


int main(void){

  ERATOSUTENESUNOHURUI();

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

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

const int PRIME_MAX = 1000001;
bool isPrime[PRIME_MAX];
void init() {
	fill(isPrime, isPrime + PRIME_MAX, true);
	isPrime[0] = isPrime[1] = false;
	for (int i = 2; i * i <= PRIME_MAX; i++) {
		if (!isPrime[i]) continue;
		for (int j = (i << 1); j < PRIME_MAX; j += i) {
			isPrime[j] = false;
		}
	}
}

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

C++: #include<stdio.h>
int main(){
  int n;
  int i,j,k,sw,c;
  int a[1000001]={};
  a[2]=1;
  j=1;
  for(i=3;i<1000000;i+=2){
    sw=0;
    for(k=2;k*k<=i;k++){
      if(a[k]==1)
	if(i%k==0){
	  sw=1;
	  break;
	}
    }
    if(sw==0)a[i]=1;
  }
  while(1){
    scanf("%d",&n);
    c=0;
    for(i=2;i<=n/2;i++){
      if(a[i]==1)
	if(a[n-i]==1)
	  c++;
    }
    printf("%d\n",c);
  }
  return 0;
}