Euler function

Learning materials: https://blog.csdn.net/sentimental_dog/article/details/52002608

 

 

Note that the last line requires res/a*(a-1)

Because a itself can be modulo a, but i*i<=a, so there is no enumeration to a itself

#include <bits/stdc++.h>
using namespace std;
const int maxn=200000+10;
#define LL long long

intmain ()
{
    int n;
    LL m;
    ios::sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
       cin>>m;
       cout<<(m-1)*euler(m)<<endl;
    }
    return 0;
}
View Code

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324736440&siteId=291194637