#Q199. 「一本通 6.2 例 1」Prime Distance
「一本通 6.2 例 1」Prime Distance
Description
Original source: Waterloo local, problem statement available at POJ 2689
Given two integers and , find the pair of adjacent prime numbers in the closed interval with the smallest difference and the pair with the largest difference. If multiple pairs exist, output the one that appears first.
Input Format
Multiple test cases. Each line contains two integers and .
Output Format
Refer to the sample output for details.
Sample 1
2 17
14 17
2,3 are closest, 7,11 are most distant.
There are no adjacent primes.
Constraints and Hints
For all test cases, .