质数距离
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
给定两个整数 和 ,你需要在闭区间 内找到距离最接近的两个相邻质数 和 ()(即 是最小的),如果存在相同距离的其他相邻质数对,则输出第一对。
同时,你还需要找到距离最远的两个相邻质数 和 ()(即 是最大的),如果存在相同距离的其他相邻质数对,则输出第一对。
输入格式
每行输入两个整数 和 ,其中 和 的差值不会超过 。
输出格式
对于每个 和 ,输出一个结果,结果占一行。
结果包括距离最近的相邻质数对和距离最远的相邻质数对。(具体格式参照样例)
如果 和 之间不存在质数对,则输出There are no adjacent primes.
2 17
14 17
2,3 are closest, 7,11 are most distant.
There are no adjacent primes.
提示
数论1、整除、质数、约数、欧拉函数
- Status
- Done
- Problem
- 17
- Open Since
- 2025-7-3 0:00
- Deadline
- 2025-8-7 23:59
- Extension
- 24 hour(s)