#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while(t--)
{
int a, b;
cin >> a >> b;
int gcd = __gcd(a, b);
int c = 0;
for(int i=1;i*i<=gcd;i++)
{
if(gcd%i == 0)
{
c += 2;
if(i*i == gcd)
c--;
}
}
cout << c << "\n";
}
return 0;
}
Comments
Post a Comment