Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Mobious Function */
- int miu[MAX],mark[MAX];
- void mobius(int n){
- for(int i=0;i<=n;i++) miu[i]=1;
- miu[0]=0;
- miu[1]=1;
- for(int i=2;i<=n;i++){
- if(mark[i]) continue;
- miu[i]=-1;
- for(int j=i*2;j<=n;j+=i){
- if(miu[j]!=0){
- if(j%(i*i)==0) miu[j]=0;
- else miu[j]*=-1;
- mark[j]=1;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement