main
黄海 2 years ago
parent 7c6bee650b
commit 60d2fac8ec

@ -3,6 +3,7 @@ using namespace std;
#define LL long long
const int N = 100 + 100;
// 筛法求莫比乌斯函数
LL mu[N], sum[N];
int primes[N], cnt;
bool st[N];
@ -24,19 +25,18 @@ void get_mobius(LL n) {
}
}
// 维护u(x)前缀和
// 这玩意有啥用?
for (LL i = 1; i <= n; i++) sum[i] = sum[i - 1] + mu[i];
}
int main() {
get_mobius(N - 1);
LL tmp;
while (cin >> tmp) {
LL sum = 1;
for (LL i = 2; i <= 64; i++) {
sum -= mu[i] * (LL)(pow(tmp * 1.0, 1.0 / i) - 1);
}
cout << sum << endl;
LL t;
while (cin >> t) {
LL s = 1;
for (LL i = 2; i <= 64; i++) s -= mu[i] * (LL)(pow(t * 1.0, 1.0 / i) - 1);
cout << s << endl;
}
return 0;
}
Loading…
Cancel
Save