#P0121. Prime Distance
Prime Distance
Description
给定两个整数 ,求闭区间 中相邻两个质数差值最小的数对与差值最大的数对。当存在多个时,输出靠前的素数对。
Format
Input
有多组数据。
每行两个数 。
Output
见样例。
Samples
2 17
14 17
2,3 are closest, 7,11 are most distant.
There are no adjacent primes.
Limitation
给定两个整数 L,R,求闭区间 [L,R] 中相邻两个质数差值最小的数对与差值最大的数对。当存在多个时,输出靠前的素数对。
有多组数据。
每行两个数 L,R。
见样例。
2 17
14 17
2,3 are closest, 7,11 are most distant.
There are no adjacent primes.
1≤L<R≤231−1
By signing up a 启智 | CDEZ OJ universal account, you can submit code and join discussions in all online judging services provided by us.