4979 - 数论:质数:【例 1】Prime Distance
Time Limit : 1 秒
Memory Limit : 512 MB
原题来自:Waterloo local,题面详见 POJ 2689
给定两个整数 L,R,求闭区间 [L,R] 中相邻两个质数差值最小的数对与差值最大的数对。当存在多个时,输出靠前的素数对。
Input
多组数据。每行两个数 L,R。
Output
详见输出样例。
Examples
Input
2 17 14 17
Output
2,3 are closest, 7,11 are most distant. There are no adjacent primes.
Hint
1<=L<R<2^31,R-L<=10^6