- Time limit: 2.00 s
- Memory limit: 512 MB
An Euler's totient function is defined as is the number of , , such that and are co-prime.
Your task is, given and , to output .
Input:
First line of input contains , number of testcases, .
In each of next lines there is a pair of integers , .
Output:
For each testcase, output a single integer, the answer to the problem.
Example:
3 6 6 7 10 10 1000
2 20 304164
Explanation:
, and , , and .