You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
689 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
//利用分解质因数模板,扩展出是不是漂亮数
bool isPLS(int x) {
for (int i = 2; i * i <= x; i++) {
int s = 0;
while (x % i == 0) x /= i, s++;
//只有1个因子就不是漂亮数
if (s == 1) return false;
}
//如果存在一个大的质数因子,也不是漂亮树
if (x > 1) return false;
return true;
}
int m, n, cnt;
int main() {
cin >> m >> n;
for (int i = m; i < n; i++)
if (isPLS(i) && isPLS(i + 1)) {
printf("%d %d\n", i, i + 1);
cnt++;
}
if (!cnt) printf("no find");
return 0;
}