How inclusion exclusion is related with Mobius function ? In F.Relatively Prime Powers judge solution with Mobius function.

Can anyone help me get the trick for this problem with Mobius function ?

Before contest

Codeforces Round #512 (Div. 1, based on Technocup 2019 Elimination Round 1)

15:17:50

Register now »

Codeforces Round #512 (Div. 1, based on Technocup 2019 Elimination Round 1)

15:17:50

Register now »

*has extra registration

Before contest

Codeforces Round #512 (Div. 2, based on Technocup 2019 Elimination Round 1)

15:17:50

Register now »

Codeforces Round #512 (Div. 2, based on Technocup 2019 Elimination Round 1)

15:17:50

Register now »

*has extra registration

# | User | Rating |
---|---|---|

1 | tourist | 3509 |

2 | OO0OOO00O0OOO0O0…O | 3327 |

3 | Syloviaely | 3274 |

4 | Um_nik | 3237 |

5 | Petr | 3161 |

6 | ko_osaga | 3154 |

7 | LHiC | 3135 |

8 | Benq | 3130 |

9 | Swistakk | 3089 |

10 | dotorya | 3060 |

# | User | Contrib. |
---|---|---|

1 | Radewoosh | 185 |

2 | rng_58 | 161 |

3 | tourist | 158 |

4 | Petr | 152 |

5 | Vovuh | 150 |

5 | Swistakk | 150 |

7 | PikMike | 147 |

8 | csacademy | 146 |

9 | Errichto | 145 |

9 | Um_nik | 145 |

How inclusion exclusion is related with Mobius function ? In F.Relatively Prime Powers judge solution with Mobius function.

Can anyone help me get the trick for this problem with Mobius function ?

↑

↓

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/23/2018 00:47:10 (d2).

Desktop version, switch to mobile version.

User lists

Name |
---|

In this problem, we know how to count the number of integers from 2 to

nhavinggcdofk_{i}divisible by some numberx(that is just , since we have exactly this number of integers not less than 2 that can be raised tox-th power without exceedingn), but we need to count the number of integers having thisgcdexactly equal to 1.How would we handle this with usual inclusion-exclusion? Let

Sbe some set of prime numbers, andf(S) be the product of primes fromS(ifSis empty, thenf(S) = 1), then the answer would be by inclusion-exclusion formula. Note that in previous formula we are summing up these values over all possible sets of prime numbersS— and since we have infinitely many prime numbers, the number of possible setsSis also infinite.However, we know that for sufficiently large

x(in the case of this problem, for something likex> 60, but typically we can apply this technique even if the border is somewhere at 10^{6}) the number of integers such thatgcdof theirk_{i}is divisible byxbecomes 0 (because quickly becomes equal to 1). And that is what gives us an opportunity to apply Mobius function.In the formula listed above, we iterated over sets of primes. Let's have it backwards: we will iterate on the integer

x, and for each such integer try to count the number of sets havingf(S) =x, and the number of primes in these sets.If the factorization of

xcontains some prime number twice (or even more than twice), then there is no such set of prime numbersSsuch thatf(S) =x. Otherwise, there is exactly one such setSwhich is equal to the factorization ofx; and if the factorization contains even number of primes, then ( - 1)^{|S|}= 1, otherwise ( - 1)^{|S|}= - 1.And now we can actually see that the previous two sentences are actually very close to the definition of Mobius function! If the factorization of

xcontains some prime twice or more, then μ (x) = 0, otherwise if the number of primes in the factorization ofxis odd, then μ (x) = - 1, and if it is even, then μ (x) = 1. This actually allows us to rewrite the formula in a more calculatable way: , whereMis some constant after which all the summands become equal to 0 (in this problemMis somewhere close to 60).If there are some questions, I can try to elaborate a bit more. In fact, we gave some other problems using this technique on previous Educational Rounds, so you can try solving them to understand it better: 915G 803F 920G

Thank u sir.Finally got it.Now I can die in peace.

BledDest Thanks for explanation.

I don't understand why that summation over all possible sets of prime numbers gives us what we want.

Actually i have two problems here:

why summing over sets of prime numbers?

Assuming first problem is solved, why does this summation gives us total number of numbers with power's gcd of one? i mean why one?