Life of Phi II
You will be given two integers n and m where GCD( n , m ) = 1. You have to tell that how many numbers are there from 1 to m * n that is co-prime to:
- n but not with m,
- m but not with n
- both m and n.
The only line of input contains two integers n and m ( 1 <= n , m <= 106 ). It is guaranteed that n and m are relatively prime.
Output three numbers as mentioned above.
1 2 2
4 6 24
Please note that for relatively prime numbers n and m, Phi( n * m ) = Phi( n ) * Phi( m ).