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.
41 lines
993 B
41 lines
993 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
#define ll long long
|
|
#define inf 0x3f3f3f3f
|
|
#define ll_inf 1ll << 60
|
|
const int maxn = 100 + 100;
|
|
ll mu[maxn * 100], prim[maxn * 100], check[maxn * 100];
|
|
int tot = 0;
|
|
void getmu() {
|
|
mu[1] = 1;
|
|
for (int i = 2; i < maxn; i++) {
|
|
if (!check[i]) {
|
|
prim[tot++] = i;
|
|
mu[i] = -1;
|
|
}
|
|
for (int j = 0; j < tot; j++) {
|
|
if (prim[j] > maxn / i) {
|
|
break;
|
|
}
|
|
check[i * prim[j]] = 1;
|
|
if (i % prim[j] == 0) {
|
|
mu[i * prim[j]] = 0;
|
|
break;
|
|
} else {
|
|
mu[i * prim[j]] = -mu[i];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int main() {
|
|
getmu();
|
|
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;
|
|
}
|
|
return 0;
|
|
} |