#include <iostream>
using namespace std;
const int limit = 11000;
static int phi[limit];
void initializePhi()
{
for (int i = 0; i < limit; i++)
phi[i] = i;
for (int i = 2; i < limit; i += 2)
phi[i] = i/2;
for (int i = 3; i < limit; i += 2)
if (phi[i] == i) {
for (int j = i; j < limit; j += i)
phi[j] = phi[j] * (i-1) / i;
}
for (int i = 1; i < limit; i += 1)
phi[i] += phi[i-1];
}
int main()
{
int P; cin >> P;
initializePhi();
while (P--) {
int K; cin >>K;
int N; cin >>N;
//computation using N
int result = 3 * phi[N] - 1;
int over2 = result % 2;
if (over2)
cout << K << " " << result << "/2" << endl;
else
cout << K << " " << result/2 << endl;
}
return 0;
}