#include<bits/stdc++.h>
using namespace std;
const int MAXN = 10005;
long long phi[MAXN];
void getphi()
{
for (int i = 1; i < MAXN; i++)
{
phi[i] = i;
}
for (int i = 2; i < MAXN; i++)
if (phi[i] == i)
for (int j = i; j < MAXN; j += i)
{
phi[j] = phi[j] / i * (i - 1);
}
}
int main()
{
getphi();
int n;
while (cin >> n)
{
cout << phi[n] << endl;
}
return 0;
}
欧拉函数打表
最新推荐文章于 2022-04-05 17:50:32 发布