#include <iostream> #include <set> using namespace std; const int maxn = 10101; int phi[maxn]; void oula(){ for (int i = 1; i <= maxn; i++) phi[i] = i; for (int i = 2; i <= maxn; i += 2) phi[i] /= 2; for (int i = 3; i <= maxn; i += 2) if(phi[i] == i) { for (int j = i; j <= maxn; j += i) phi[j] = phi[j] / i * (i - 1); } for (int i = 2; i <= maxn; i++) phi[i] += phi[i - 1]; } int main(){ int T; cin >> T; oula(); while (T--){ int no, p, q; cin >> no >> p; int ans = phi[p] * 3 - 1; //cout << no << " " << phi[p] << endl; if (ans % 2) cout << no << " " << ans << "/2" << endl; else cout << no << " " << ans / 2 << endl; } }