#include using namespace std; void solve(){ int N,K; cin>>N>>K; vector p(N+1,-1); for(int i=2;i<=N;++i){ for(int j=i;j<=N;j+=i){ if(p[j]==-1){ int x=j; while(x%i==0) x/=i; p[j]=x; } } } vector f(N+1,-1); f[1]=0; int ans=0; for(int i=2;i<=N;++i){ f[i]=f[p[i]]+1; if(f[i]>=K) ans++; } cout<>t; for(;t--;) solve(); }