Блог пользователя Death_Scythe

Автор Death_Scythe, история, 10 лет назад, По-английски

Hello all! :)

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

http://www.spoj.com/problems/ADDLCM/

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
  • Проголосовать: не нравится

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

This will help blog

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 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!

»
10 лет назад, скрыть # |
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.