`{"id":"627f9f1e-b451-4d8e-836a-e050229751a0","name":"Count Of Common Divisors","description":"Given two integer numbers, your task is to find count of all common divisors of given numbers","inputFormat":"The first line contains an integer T, number of test cases.\r\nThe next t lines contain two numbers a and b each.","outputFormat":"Print number of common divisors in next t lines.","constraints":"1&lt;= t &lt;= 10^5\r\n1&lt;= a, b &lt;= 10^5","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.ArrayList;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws NumberFormatException, IOException {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"3\r\n100000 100000\r\n12 24\r\n747794 238336","sampleOutput":"36\r\n6\r\n2\r\n\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"086949fa-3c5e-40c6-8a9c-f9be4b400318","name":"Number Theory For Experts","slug":"number-theory-for-experts","type":0},{"id":"ca5aa38f-bc98-4278-86dc-a8a6106aef3e","name":"Count Of Common Divisors","slug":"count-of-common-divisors","type":1}],"next":{"id":"7895bed5-165d-490e-a881-1ccfc76b73fb","name":"Gcd Length","type":1,"slug":"gcd-length"},"prev":{"id":"319f8b60-b521-4b74-9e86-f8673e9a6665","name":"All Factors Using Sieve","type":1,"slug":"all-factors-using-sieve"}}}`

# Count Of Common Divisors

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

`{"id":"627f9f1e-b451-4d8e-836a-e050229751a0","name":"Count Of Common Divisors","description":"Given two integer numbers, your task is to find count of all common divisors of given numbers","inputFormat":"The first line contains an integer T, number of test cases.\r\nThe next t lines contain two numbers a and b each.","outputFormat":"Print number of common divisors in next t lines.","constraints":"1&lt;= t &lt;= 10^5\r\n1&lt;= a, b &lt;= 10^5","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.ArrayList;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws NumberFormatException, IOException {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"3\r\n100000 100000\r\n12 24\r\n747794 238336","sampleOutput":"36\r\n6\r\n2\r\n\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"086949fa-3c5e-40c6-8a9c-f9be4b400318","name":"Number Theory For Experts","slug":"number-theory-for-experts","type":0},{"id":"ca5aa38f-bc98-4278-86dc-a8a6106aef3e","name":"Count Of Common Divisors","slug":"count-of-common-divisors","type":1}],"next":{"id":"7895bed5-165d-490e-a881-1ccfc76b73fb","name":"Gcd Length","type":1,"slug":"gcd-length"},"prev":{"id":"319f8b60-b521-4b74-9e86-f8673e9a6665","name":"All Factors Using Sieve","type":1,"slug":"all-factors-using-sieve"}}}`

Editor

# Count Of Common Divisors

easy

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

## Constraints

1<= t <= 10^5 1<= a, b <= 10^5

## Format

### Input

The first line contains an integer T, number of test cases. The next t lines contain two numbers a and b each.

### Output

Print number of common divisors in next t lines.

## Example

Sample Input

```.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}3 100000 100000 12 24 747794 238336```

### Sample Output

```.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}36 6 2 ```

Discussions

Show Discussion

Related Resources