#include <bits/stdc++.h>   using namespace std;   bool sieve[100000 + 5];   vector<long long> primes;   int inf[100000 + 5];   vector<vector<int> > g;   vector<vector<int> > h;   vector<int> rab;   vector<int> rtb;   vector<int> res;   void rec(int id, int del) {     if (id == rab.size()) {       res.push_back(del);       return;     }     int cum = 1;     for (int i = 0; i <= rab[id]; i++) {       rec(id + 1, del * cum);       cum *= rtb[id];     }   }   void gen1(int i) {     res.clear();     rab = g[i];     rtb = h[i];     rec(0, 1);   }   void fill() {     int san;     int cnt;     for (int i = 2; i < 100000 + 1; i++) {       san = i;       for (int j = 0; primes[j] <= san; j++) {         cnt = 0;         while (san % primes[j] == 0) {           san /= primes[j];           cnt++;         }         if (cnt > 0) {           g[i].push_back(cnt);           h[i].push_back(primes[j]);         }         if (san == 0) break;         if (sieve[san]) {           g[i].push_back(1);           h[i].push_back(san);           break;         }       }     }   }   void oku() {     memset(sieve, true, sizeof sieve);     g.assign(100000 + 1, vector<int>(0));     h.assign(100000 + 1, vector<int>(0));     sieve[1] = sieve[0] = false;     for (long long i = 2; i * i <= 100000; i++)       if (sieve[i])         for (long long j = i * i; j <= 100000; j += i) sieve[j] = false;     int cnt = 0;     for (int i = 0; i < 100000; i++)       if (sieve[i]) primes.push_back(i);     fill();     int n, x, y, id;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d%d , &x, &y);       gen1(x);       id = i + 1 - y;       cnt = 0;       for (int j = 0; j < int((res).size()); j++) {         if (inf[res[j]] < id) cnt++;         inf[res[j]] = i + 1;       }       printf( %d n , cnt);     }   }   int main() {     oku();     return 0;   }   