# "Verification Goldbach conjecture" of OJ Brush problem

Source: Internet
Author: User

Title Description

Write a function Gotbaha, verify that "every even number not less than 6 is the sum of two odd primes", enter an even N of not less than 6, find two prime numbers, so that their sum is n.

Input

Enter an even N of not less than 6

Output

Find two of the primes to make them n.

Sample input
`80`
Sample output
`80=7+73`
Tips

The main function is given below, and it is not required to include the following main function when committing

/* C code */

int main ()

{

int n;

int Gotbaha (int);

int prime (int);

scanf ("%d", &n);

Gotbaha (n);

return 0;

}

/* C + + code */

int main ()

{

int n;

int Gotbaha (int);

int prime (int);

cin>>n;

Gotbaha (n);

return 0;

}

The code is as follows:

`#include <iostream> #include <iomanip> #include <cmath>using namespace std;int gotbaha (int n) {    int prime (int);    int a, B;    for (a=3;a<=n/2;a=a+2)    {        if (prime (a))        {            b=n-a;            if (prime (b))            {                cout<<n<< "=" <<a<< "+" <<b<<endl;                Break;}}}}    int prime (int m) {    int i,k=sqrt (m);    for (i=2;i<=k;i++)        if (m%i==0) break        ;    if (i>k) return 1;    else return 0;} int main () {    int n;    int Gotbaha (int);    int prime (int);    cin>>n;    Gotbaha (n);    return 0;}`

Operation Result:

Suddenly feel that the problem is some uncomfortable ah,, one is not to output in the main function and the function type is int, and the other is that the output requirement is not to put a number of all cases are lost. When submitted to the OJ platform is not confirmed.

"Verification Goldbach conjecture" of OJ Brush problem

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.