HDU 1262 seeks prime numbers to play a table on number theory.

Source: Internet
Author: User

Looking for prime number pairsTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 8771 Accepted Submission (s): 4395


Problem description Goldbach Guess we all know a little bit. We're not trying to prove that, but we want to take an even number out of a set of numbers that can be represented within a programming language to find two primes so that they are equal to that even.
By doing this, we can show that this conjecture is set up.
Since there can be different prime pairs to represent the same even number, it is specifically required that the prime pair being searched is the closest of two.

Input inputs are some even integer M (5<m<=10000).

Output for each even number, outputs two prime numbers closest to each other, and equals the even number.

Sample Input
20 30 40

Sample Output
7 1313 1717 23
is to make a watch. No, nothing else.
#include <stdio.h> #define MAX 10100bool Notprime[max];//int Prime[max]; int main () {for (int i = 2; i < MAX; ++i {for (int j = 2; j*i < MAX; ++j) {notprime[i*j] = true;}} Notprime[1] = true; int n, while (~scanf ("%d", &n)) {int mid = N/2; for (int i = mid; I < n; ++i) {if (!notprime[i]) {fo R (Int j = mid; J > 1;--j) {if (!notprime[j]) {if (i+j==n) {printf ("%d%d\n", j,i); goto here;} else if (i+j<n) {break;}} else if (i+j<n) {break;}}}} here:;} return 0;}

with June

HDU 1262 seeks prime numbers to play a table on number theory.

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.