Use C program to verify the gedebach Conjecture

Source: Internet
Author: User

Is an even number that is large enough to be written as the sum of two prime numbers.

1 # include <stdio. h> 2 # include <math. h> 3 4 int main (void) 5 {6 int I, j; 7 int num = 30284; // any number greater than 6 is 8 int p, q; 9 int flagp, flagq; 10 11 p = 1; 12 do13 {14 p = p + 1; 15 q = num-P; 16 flagp = 1; 17 flagq = 1; 18 19 for (I = 2; I <SQRT (double) P); ++ I) 20 {21 if (P % I = 0) 22 {23 flagp = 0; 24 break; 25} 26} 27 28 J = 2; 29 While (j <SQRT (double) q )) 30 {31 if (Q % J = 0) 32 {33 flagq = 0; 34 break; 35} 36 + + J; 37} 38} while (flagq * flagq = 0); 39 40 printf ("% d = % d + % d \ n", num, p, q ); 41 return 0; 42}

The idea is to start from p = 1 and determine whether to separate the two numbers P after the large number is decomposed. Q is a prime number. If not, the result is output. If not, the Operation will continue with 1.

Use C program to verify the gedebach Conjecture

Contact Us

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.