Description: Primes distance problem
Time Limit: 3000 ms | Memory Limit: 65535 KB
Difficulty: 2
Description
You are given a couple, ask you to write a program that outputs these integers nearest neighbor primes, and the output of its length apart. If there are equidistant about the length of a prime number, and the corresponding output value from the left.
If the integer input is itself a prime number, then the output of the primes itself from output 0
Enter
The first line gives the number of test data sets N (0 <N <= 10000)
The next N lines contains an integer M (0 <M <1000000),
Export
Each line of the output of two integers A B.
Wherein A represents a corresponding test data from the nearest prime number, B is the distance therebetween.
Sample Input
3
6
8
10 Sample Output
51
71
To Search:
File list (Check if you may need any files):
24.cpp