/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define M 1000000
int p[1000000] = {1};
void sieve(int p[], int m)
{
// wmemset(p, 1, m);
// p[m] = ;
for (ll i = 2; i <= m; i = i + 2)
{
p[i] = 2;
}
for (int i = 3; i <= m; i = i + 2)
{
for (int j = i; j <= m; j = j + i)
{
if (p[j] == 0)
{
p[j] = i;
}
}
}
p[0] = 0;
p[1] = 1;
return;
}
int main()
{
int t;
cin >> t;
sieve(p, M);
// for (int i = 0; i <= 50; i++)
// {
// cout << p[i] << " ";
// }
// cout << endl;
while (t--)
{
int n;
cin >> n;
double to = n;
int prev;
while (n != 1)
{
// double f = n/p[n];
to *= (1 - double(1.000 / p[n]));
// cout << 1 - double(1.000 / p[n]) << " ";
// cout << to << endl;
prev = n;
n = n / p[n];
if (n == p[n])
{
break;
}
}
cout << to << endl;
}
return 0;
}