#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int gcd(int a,int b){
int c;
while(b){
c=b;
b=a%b;
a=c;
}
return a;
}
int lcm(int a,int b){
return (a/(gcd(a,b)))*b;
}
int main(){
int x,y;
cin>>x>>y;
int total=x*y;//两个数的乘积同时也是gcd和lcm的乘积
int j;//i是第一个数,j是第二个数
int ans=0;
for(int i=x;i<=total;i+=x){
j=total/i;
if(i*j==total){if((gcd(i,j)==x)&&(lcm(i,j)==y)) ans++;}//如果满足条件
}
cout<<ans;
return 0;
}
温习gcd(用辗转相除法来做)和lcm(用gcd来算)