Abhi and Santa

2

1 votes
Medium
Problem

Abhi was expecting a gift from Santa on Christmas but Santa told him to Solve a problem then only he will give him the gift. it's been five days and Abhi has not been able to Solve the problem so he asks for your help.Two integers A and B are given and it asks to find the greatest number X which divides the sum of the count of divisors of A and B as well as divides the absolute difference of count of divisors of A and B.

Input:

Input consists of T test cases. each test case contains two integers A and B.

Output:

Each test case contains the answer to the problem on a new line.

Constraints:

1<=T<=5

1<=A,B<=10^18

Sample Input
3
36 8 
6 16 
12 36
Sample Output
1
1
3
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

In first test case, 36 has 9 divisors and 8 has 4 divisors.sum of count of divisor will be 13 and absolute difference of divisor will be 5.so the greatest number 13 and 5 will be 1.

Editor Image

?