Number Theory Problem from UVA (UVA 12888 Count LCM)

Revision en2, by Tobby_And_Friends, 2016-11-04 07:55:17

Problem name: Count LCM

Link: https://uva.onlinejudge.org/external/128/12888.pdf

Let's say n < m. Then the answer is for each integers i, from 1 to n, how many integers up to m are co-prime with i. I tried solving the problem but it got me a TLE. How do I optimize my solution? Any help is really appreciated.

Solution Link: http://ideone.com/mMoWMS

Tags number theory

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Tobby_And_Friends 2016-11-04 07:55:17 2 Tiny change: 'ount LCM\nLink: ht' -> 'ount LCM\n\nLink: ht'
en1 English Tobby_And_Friends 2016-11-04 07:54:38 412 Initial revision (published)