main
黄海 2 years ago
parent 7bbe6ec411
commit 2cf121fac0

@ -1,21 +1,30 @@
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 100 + 100;
#define int long long
#define endl "\n"
const int N = 110;
/*
10
36
1000000000000000000
4
9
1001003332
*/
// 筛法求莫比乌斯函数
LL mu[N], sum[N];
int mu[N], sum[N];
int primes[N], cnt;
bool st[N];
void get_mobius(LL n) {
void get_mobius(int n) {
mu[1] = 1;
for (LL i = 2; i <= n; i++) {
for (int i = 2; i <= n; i++) {
if (!st[i]) {
primes[cnt++] = i;
mu[i] = -1;
}
for (LL j = 0; primes[j] <= n / i; j++) {
LL t = primes[j] * i;
for (int j = 0; primes[j] <= n / i; j++) {
int t = primes[j] * i;
st[t] = true;
if (i % primes[j] == 0) {
mu[t] = 0;
@ -26,18 +35,18 @@ void get_mobius(LL n) {
}
// 维护u(x)前缀和
// 这玩意有啥用?
for (LL i = 1; i <= n; i++) sum[i] = sum[i - 1] + mu[i];
for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + mu[i];
}
int main() {
signed main() {
// 筛法求莫比乌斯函数
get_mobius(N - 1);
LL T;
int 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);
int s = 1;
for (int i = 2; i <= 64; i++) s -= mu[i] * (int)(pow(T * 1.0, 1.0 / i) - 1);
cout << s << endl;
}
return 0;
}
Loading…
Cancel
Save