Skip to content

Commit 88b16ee

Browse files
author
taotao
committed
修改欧拉函数筛法bug
1 parent 11a97e7 commit 88b16ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: math/莫比乌斯反演笔记.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ void phi_table(){
6060
}
6161
for(int j=0 ; j<cnt && i*prime[j]<maxn ; ++j){
6262
prime[i*prime[j]] = 1;
63-
if(i%prime[j])phi[prime[j]*i] = phi[i]*(phi[prime[j]]-1);
63+
if(i%prime[j])phi[prime[j]*i] = phi[i]*(phi[prime[j]]);
6464
else {
65-
phi[i*prime[j]]= phi[i]*phi[prime[j]];
65+
phi[i*prime[j]]= phi[i]*prime[j];
6666
break;
6767
}
6868
}

0 commit comments

Comments
 (0)