Problem : http://acm.timus.ru/problem.aspx?space=1&num=1673
Through Discussion forum I found that it can be solved using Euler Totient Function. I have tried for 24 hours but couldn't understand the reason behind using Euler Totient function for this problem.
I feel glad if someone can explain me with the approach to the problem.
Thanks in advance.