首页 > 编程知识 正文

6的欧拉函数,java native方法

时间:2023-05-06 19:14:47 阅读:109926 作者:1213

简单求出欧拉函数值,留下来做模板。 。

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;

出局

}

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。