[CSES][Mathematics] Counting Coprime Pairs

Поділитися
Вставка
  • Опубліковано 28 жов 2024

КОМЕНТАРІ • 14

  • @justsvk1500
    @justsvk1500 3 місяці тому

    Hello! Thank you for showing us this editorial! It's really crazy how we can simply reform this problem into a sieve problem. I thought of some principle of inclusion-exclusion magic aswell, but deemed it as not feasible. Please, continue with these editorials, they are simply fabulous! I love especially how you thoroughly explain every step with proofs aswell - that's something others disregard. Take care!

  • @pranshunayak1792
    @pranshunayak1792 Рік тому +3

    Very grateful for this mathematics playlist ! It's rare and precious

  • @aniket6817
    @aniket6817 Рік тому +1

    How nicely u explained it, nothing could be better than this.Thanks a ton

  • @gatoradeee
    @gatoradeee 3 роки тому +2

    Very well presented my friend thank you. Had a lot of trouble understanding the solution of this problem until now.

  • @hrithikkale443
    @hrithikkale443 3 роки тому +2

    Thnx for this wonderful lect

  • @parthpawar7837
    @parthpawar7837 3 роки тому +2

    Can this also be solved using Mobius function or ETF? Is so, how?

    • @neatlystructured
      @neatlystructured  3 роки тому +2

      I don't think so, but i m not sure there isnt a clever way to do it. Of course euler totient function will easily find all unordered coprims pairs but only over a range, but since we have discrete values here, i dont see how it can be done. Thank you for your comment, and please let me know if you find out how!

    • @thefluxxx16
      @thefluxxx16 6 місяців тому +1

      ​@@neatlystructured The answer to the problem is ∑ for k=1 to max(x[i]) of the function ( u(k) * C( d(k), 2 ) )
      d(k) is the number of integers in given sequence that are divisible by k
      We see that this result comes from the Inclusion-Exclusion principle. The term in the summation corresponds to choosing two numbers which are multiples of k
      , and μ(k)
      decides whether we add it or not. Note that in inclusion-exclusion, we don’t consider k
      which aren’t square free, as it doesn’t add any effect to our answer.
      - I read it on cf edutorial, but I didn't understood much

  • @prabhusubramanian1205
    @prabhusubramanian1205 2 роки тому +2

    Can you provide lik to your submission?

    • @neatlystructured
      @neatlystructured  2 роки тому

      sure here you go:
      github.com/ars-longa-vita-brevis/CSES/blob/master/Mathematics/CountingCoprimePairs.cpp
      sorry for late reply