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>
using namespace std;

bool isPrime(unsigned int n);

int main(void){
  int n;
  while(cin>>n && n){
    unsigned int count=0;
    if(n==4) count=1;
    for(unsigned int i=3;i<=n/2;i+=2) if(isPrime(i) && isPrime(n-i)) count++;
    cout<<count<<endl;
  }
}

bool isPrime(unsigned int n){
  for(unsigned int i=3;i*i<=n;i+=2) if(n%i==0) return false;
  return true;
}