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