Files
python/TangDou/ShuLun/SL4.cpp

27 lines
689 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#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;
}