#include <iostream>
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
int prime[maxn];
bool notprime[maxn];
ll n,area;
void getprime(){memset(prime,0,sizeof(prime));memset(notprime,false,sizeof(notprime));notprime[0]=notprime[1]=true;for(int i=2;i<maxn;++i){if(!notprime[i]) prime[++prime[0]]=i;for(int j=1;j<=prime[0]&&prime[j]<=maxn/i;++j){notprime[prime[j]*i]=1;if(i%prime[j]==0)break;}}
}
int solve(){if(area/n<n)return 0;int ans=1;ll temp=area;for(int i=1; area/prime[i]>=prime[i];++i){int cnt=0;if(area%prime[i]==0){while(area%prime[i]==0){area/=prime[i];cnt++;}ans*=(cnt+1); }}if(area>1)ans<<=1; ans>>=1; //as an cloculsion://n have how many pairs of factors can be: n the number of factors divided by 2for(int i=1;i<n;++i){// because of the other factor greater or equal nif(temp%i==0)--ans;
}
return ans;
}
int main(){getprime();int t;scanf("%d",&t);//in>>t;for(int ca=1;ca<=t;++ca){scanf("%lld%lld",&area,&n);printf("Case %d: %d\n",ca,solve());}return 0;
}