/* * 因数个数(使用到质数筛法) */ #include <iostream> #include <cstdio> #include <vector> #include <math.h> using namespace std; const int MAXN = 4e4; bool isPrime[MAXN]; //标记数组 vector<int> prime; //保存质数 void initial(){ //初始化 fill(isPrime,isPrime+MAXN,true); isPrime[0]=false; isPrime[1]=false; for(int i = 2;i<MAXN;i++){ if(!isPrime[i]){ //非质数,则跳过该数 continue; } prime.push_back(i); for(int j = i+i;j<MAXN;j+=i){ isPrime[j]=false; //质数的倍数为非质数 } } return; } int fun(int n){ vector<int> exponent; for(int i = 0;i<prime.size();i++){ int factor = prime[i]; if(n<factor){ break; } if(n%factor == 0){ int num = 0; while(n%factor == 0){ n = n/factor; num++; } exponent.push_back(num); } } if(n>1){ exponent.push_back(1); } int ans = 1; for(int i = 0;i<exponent.size();i++){ ans*=exponent[i]+1; } return ans; } int main(){ initial(); int m; while(scanf("%d",&m)!=EOF){ if(m == 0){ break; } for(int i = 0;i<m;i++){ int n; scanf("%d",&n); printf("%d\n",fun(n)); } } return 0; }