Common Divisors
Submissions: 2436   Accuracy:

47.5%

  Difficulty: Basic   Marks: 1

Given two integer numbers, the task is to find count of all common divisors of given numbers?

Input : a = 12, b = 24
Output: 6
// all common divisors are 1, 2, 3, 
// 4, 6 and 12

Input : a = 3, b = 17
Output: 1
// all common divisors are 1

Input : a = 20, b = 36
Output: 3
// all common divisors are 1, 2, 4

Input:
The first line of input contains a single integer T denoting the number of test cases. Then T test cases follow. Each test case consists of one line only. The line consists one two space separated positive integers which denote a and b.


Output:
Corresponding to each test case, in a new line, print the number of common divisors.

Constraints:
1 ≤ T ≤ 200
1 ≤ a,b ≤ 10000

Example:
Input:
2
232 8
1 354

Output:

4
1

** For More Input/Output Examples Use 'Expected Output' option **

Author: kartik


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.