There are numbers from 1, 2, 3 ... N (N <= 500000). Write a program that distributes the numbers in pairs so that their sum is a prime number. I do not know how to make this distribution correctly, tell me. I wrote as I know, but the campaign is not at all that.
#include "stdafx.h" #include <iostream> using namespace std; int main() { setlocale(LC_ALL, "rus"); int i,a; int A[500000]; for (i = 1; i <= 500000; i++) a = A[i]; a += A[i + 1]; if ((a%a == 1) && (a % 1 == 1)) cout << a; system("pause"); }
(a%a == 1)- give an example when this condition is true. The same is for(a % 1 == 1). - Igor;- Senior Pomidor