intS(re int x,re int y){ if(x<=1||g[y]>x) return0; else{ re int id=x<=sq?id1[x]:id2[n/x]; re int res=F[id]-fsum[y-1]; for(re int i=y;i<=g[0]&&g[i]*g[i]<=x;++i) for(re int p=g[i];p*g[i]<=x;p*=g[i]) res+=/*1*/*S(x/p,i+1)+/*2*/; //1 处应填 f(p),2 处应填 f(p*g[i]) return res; } }
int t,n,sq,m; int f[maxn+1],g[maxn+1],w[(maxn<<1)+1],id1[maxn+1],id2[maxn+1]; int prmcnt[maxn+1],prmCnt[(maxn<<1)+1]; longlong prmsum[maxn+1],prmSum[(maxn<<1)+1];
longlonggetPhi(re int x,re int y){ if(x<=1||g[y]>x) return0; else{ re int id=x<=sq?id1[x]:id2[n/x]; re longlong res=(prmSum[id]-prmCnt[id])-(prmsum[y-1]-prmcnt[y-1]); for(re int i=y;i<=g[0]&&1LL*g[i]*g[i]<=x;++i) for(re int p=g[i];1LL*p*g[i]<=x;p*=g[i]) res+=1LL*p/g[i]*(g[i]-1)*getPhi(x/p,i+1)+1LL*p*(g[i]-1); return res; } }
intgetMu(re int x,re int y){ if(x<=1||g[y]>x) return0; else{ re int id=x<=sq?id1[x]:id2[n/x]; re int res=prmcnt[y-1]-prmCnt[id]; for(re int i=y;i<=g[0]&&1LL*g[i]*g[i]<=x;++i) res-=getMu(x/g[i],i+1); return res; } }
intmain(){ for(re int i=2;i<=maxn;++i){ if(!f[i]){ g[++g[0]]=i; prmcnt[g[0]]=prmcnt[g[0]-1]+1; prmsum[g[0]]=prmsum[g[0]-1]+i; } for(re int j=1;j<=g[0]&&1LL*i*g[j]<=maxn;++j){ f[i*g[j]]=1; if(!(i%g[j])) break; } } cltstream::read(t); for(;t;--t){ cltstream::read(n); sq=sqrt(n); m=0; for(re int l=1,r;l<=n;r=n/(n/l),l=r+1){ w[++m]=n/l; prmCnt[m]=w[m]-1; prmSum[m]=1LL*(w[m]-1)*(w[m]+2)/2; if(w[m]<=sq) id1[w[m]]=m; else id2[n/w[m]]=m; } for(re int j=1;j<=g[0];++j) for(re int i=1;i<=m&&w[i]>=1LL*g[j]*g[j];++i){ re int id=w[i]/g[j]<=sq?id1[w[i]/g[j]]:id2[n/(w[i]/g[j])]; prmCnt[i]-=prmCnt[id]-prmcnt[j-1]; prmSum[i]-=1LL*g[j]*(prmSum[id]-prmsum[j-1]); } cltstream::write(getPhi(n,1)+1,32); cltstream::write(getMu(n,1)+1,10); } clop(); return0; }