1 #include<cstdio> 2 int f1(int a,int b) //最大公约数 3 { 4 if(a % b == 0) return b; 5 else 6 return f1(b,a%b); 7 } 8 int f2(int a,int b) //最小公倍数 9 { 10 int g; 11 g=a*b/f1(a,b); 12 return g; 13 } 14 int main() 15 { 16 int t,i; 17 scanf("%d",&t); 18 while(t--) 19 { 20 int a,b; 21 scanf("%d%d",&a,&b); 22 for(i=b+1;i<=a*b;i++) 23 { 24 if(b == f1(a,i)) 25 { 26 printf("%d ",i); 27 break; 28 } 29 } 30 } 31 }