简单求出欧拉函数值,留下来做模板。 。
gennn,a positive integer,howmanypositiveintegerslessthannarerelativelyprimeton? twointegersaandbarerelativelyprimeiftherearenointegersx 1,y 0,z 0 such that a=xy and b=xz。
输入
thereareseveraltestcases.foreach test case,standardinputcontainsalinewithn=1,000,000,000.aline containing0folllowsthsthollllowsthtestestating
Output
foreachtestcasethereshouldbesinglelineofoutputansweringthequestionposedabove。
样品输入
7
12
0
样品输出
6
4
交流电源线:
#包含
#包含
#包含
using namespace std;
长日志(长日志y ) {
intm=(int ) sqrt ) y0.5;
int ans=y;
for(intI=2; i=m; I ) {
if(y%I==0) {
ans=ans/I*(I-1;
wile(y%I==0) ) ) ) ) ) )。
y/=i;
}
}
if(y1 ) )。
ans=ans/y*(y-1;
返回ans;
}
int main () )
{
龙龙n;
wile(Cinnn ) {
长龙x=Euler (n;
出局
}
}