Death_Scythe's blog

By Death_Scythe, history, 8 years ago,

Hello all! :)

I stumbled upon this problem but I do not know how to solve it.

The sum can be written as

but this doesn't make the problem any easier. I can evaluate the first sum but its not easy to evaluate the second. Please give me some ideas to solve this.

Any help is appreciated. Thanks!

• +3

 » 8 years ago, # |   +4 This will help blog
•  » » 8 years ago, # ^ |   0 I already read it but I do not see how to simplify the second sum in terms of totient function.
•  » » » 8 years ago, # ^ | ← Rev. 13 →   0 We have to basically calculate: Now , using the property LCM(x, y) = x * y / gcd(x, y)The summation changes to : (See I have change the limits that is why an extra N on the left side as i=N is trivial) Now writing the summation in reverse order:  ≠ wline Adding the first and this equation you get: which can be computed and we can output x.
•  » » » » 8 years ago, # ^ |   +4 Please read the problem I am trying to ask. I already know how to evaluate the sum you have mentioned (basically the first sum in OP), I am facing trouble evaluating the second sum, the limits of which do not end at b. Thanks!
 » 8 years ago, # |   0 Anyone? I am really stuck on this one for a long time. I feel this can be solved with Mobius inversion but given my inexperience with that, I am not sure how to proceed in that direction.As before, any help is appreciated. Thanks!
•  » » 8 years ago, # ^ |   0 Detailed Editorial : https://discuss.codechef.com/questions/4258/lcm-editorial
•  » » » 8 years ago, # ^ |   0 Hello MedoWith11Es! I have already seen that editorial (believe me, I have looked at a lot of stuff for this problem) but I think these two problems are very different or maybe I a overlooking something. Can you please show how these two problems relate to each other?
 » 8 years ago, # | ← Rev. 2 →   0 You can transform the sum a bit to a sum of expressions like this: i.e. a sum of numbers relatively prime to z. As z ≤ 106, it can't have more than 7 prime divisors, and the sum can be calculated quite fast using the inclusion-exclusion principle.