http://poj.org/problem?id=2262
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std ;
#define INT long long
INT judge( INT n )
{
if( n % 2 == 0 )
return 0 ;
else
{
for( INT i = 3 ; i <= sqrt( ( double ) n ) ; i += 2 )
if( n % i == 0 )
return 0 ;
return 1 ;
}
return 0 ;
}
int main()
{
INT n ;
while( scanf( "%lld" , &n ) != EOF )
{
if( n == 0 )
break ;
if( n % 2 != 0 || n < 6 )
return 0 ;
int flag = 1 ;
for( INT i = 3 ; i <= n / 2 ; i += 2 )
{
if( judge( i ) && judge( n - i ) )
{
printf( "%lld = %lld + %lld\n" , n , i , n - i ) ;
flag = 0 ;
break ;
}
}
if( flag )
printf( "Goldbach's conjecture is wrong.\n" ) ;
}
return 0 ;
}