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.