## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Possible GCD CodeChef Solution | CodeChef Problem Solution 2022

Chef has two distinct positive integers $A$ and $B$.

Chef wonders how many distinct values are possible for the expression $\mathrm{g}\mathrm{c}\mathrm{d}\left(A+X,B+X\right)$, where $X$ can take any non-negative integer value.

Help Chef find this value.

Here, $\mathrm{g}\mathrm{c}\mathrm{d}$ stands for Greatest Common Divisor.

### Input Format

• The first line contains a single integer $T$ — the number of test cases. Then the test

• cases follow.
• The first and only line of each test case contains two distinct space separated integers $A$ and $B$.

### Output Format

For each testcase, output the number of distinct values of the expression $\mathrm{g}\mathrm{c}\mathrm{d}\left(A+X,B+X\right)$,

where $X$ can take any non-negative integer value.

### Constraints

• $1\le T\le 1000$
• $1\le A,B\le {10}^{9}$