#P6052. Yltx Prime Pair Check
Yltx Prime Pair Check
Yltx Prime Pair Check
A yltx prime pair is defined as follows: Given two integers \(x\) and \(y\), if the expression \[ x \times y - 3\times (x-y) \] results in a prime number, then the pair \((x,y)\) is called a yltx prime pair.
You are given \(T\) pairs generated using a seed \((x_0,y_0)\). The data are generated by the following procedure:
// C++ pseudocode for data generation #include using namespace std; int T, x_0, y_0; int main() { scanf("%d%d%d", &T, &x_0, &y_0); while(T--) { x_0 = ((7*x_0+13) ^ (x_0/13-7)); y_0 = ((7*y_0+13) ^ (y_0/13-7)); int x = ((x_0 % 10000 + 10000) % 10000) + 1; int y = ((y_0 % 10000 + 10000) % 10000) + 1; // (x, y) is one test case } return 0; }
Your task is to simulate the above data generation process and for each generated pair \((x,y)\), check whether it is a yltx prime pair. In other words, for each pair, compute \[ E = x \times y - 3\times (x-y), \] and if \(E\) is a prime number (note that a prime is an integer greater than 1 that has no positive divisors other than 1 and itself), then the answer for that test case is "Yes"; otherwise, it is "No".
inputFormat
The first line of input contains three integers: \(T\), \(x_0\), and \(y_0\). These represent the number of test cases and the seed values, respectively.
Data for each test case are generated using the following procedure:
while(T--) { x_0 = ((7*x_0+13) ^ (x_0/13-7)); y_0 = ((7*y_0+13) ^ (y_0/13-7)); int x = ((x_0 % 10000 + 10000) % 10000) + 1; int y = ((y_0 % 10000 + 10000) % 10000) + 1; // use x and y }
outputFormat
For each test case, output a single line containing either Yes
if the corresponding pair \((x,y)\) is a yltx prime pair, or No
otherwise.
sample
3 1 1
No
No
No
</p>