关于哥德巴赫猜想的一个问题
											哥德巴赫曾猜测:任何大于6的偶数都可以分解成两个素数(素数对)的和。但有些偶数可以分解成多种素数对的和,如: 10=3+7,10=5+5,即10可以分解成两种不同的素数对。试求6744可以分解成多少种不同的素数对(注: A+B与B+A认为是相同素数对)    144这个问题小弟想了很久很久了 就是没有思路啊!!!求路过的大侠给小弟个答案!!!
由于小弟菜鸟 所以请大侠只用简单的循环和函数来做这个问题 不胜感激!!!
 2011-04-23 22:13
	    2011-04-23 22:13
   程序代码:
程序代码:for (cnt = 0, i = 3; i < 3372; i+= 2) {
    if (is_prime_p(i) && is_prime_p(6744 - i)) {
        cnt++;
    }
} 2011-04-23 22:57
	    2011-04-23 22:57
   2011-04-23 23:08
	    2011-04-23 23:08
   2011-04-24 00:27
	    2011-04-24 00:27
   2011-04-24 00:41
	    2011-04-24 00:41
   2011-04-24 09:16
	    2011-04-24 09:16
   2011-04-24 13:50
	    2011-04-24 13:50
   2011-04-26 18:33
	    2011-04-26 18:33
  
 2011-04-27 08:45
	    2011-04-27 08:45
   程序代码:
程序代码:#include<conio.h>
#include<stdio.h>
#include<math.h>
#include<iostream>
using namespace std;
int IsPrimeNum(int x)
{
    double y=x;
    if(x==2||x==3)return 1;
    else
    {
        int i=2;
        while(i<=sqrt(y)&&x%i!=0)i++;
        if(i<=sqrt(y)) return 0;
        else return 1;
    }      
}   
int main()
{
    int num,count;
    while(cin>>num)
    {
        count=0;
        for(int i=2;i<=num/2;i++)
            if(IsPrimeNum(i)&&IsPrimeNum(num-i))count++;
        cout<<count<<endl;
    }   
    getch();
    return 0;
} 结果144.										
					
	
 2011-04-27 08:46
	    2011-04-27 08:46