#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
vector<int>d[1000005];
long int a[1000002];
void divisor()
{
int i, j;
ll maxi = 0;
ll c = 0;
for(i=1; i<=1000001; i++)
{
for(j=i; j<=1000001; j+=i)
d[j].push_back(i);
if(maxi <= d[i].size())
{
maxi = d[i].size();
c = i;
a[i] = c;
}
else
a[i] = c;
}
}
int main()
{
ll n, i;
divisor();
while(cin >> n && n > 0)
{
ll m;
for(i=1; i<=n; i++)
{
cin >> m;
cout << a[m] << endl;
}
}
return 0;
}
#define ll unsigned long long int
using namespace std;
vector<int>d[1000005];
long int a[1000002];
void divisor()
{
int i, j;
ll maxi = 0;
ll c = 0;
for(i=1; i<=1000001; i++)
{
for(j=i; j<=1000001; j+=i)
d[j].push_back(i);
if(maxi <= d[i].size())
{
maxi = d[i].size();
c = i;
a[i] = c;
}
else
a[i] = c;
}
}
int main()
{
ll n, i;
divisor();
while(cin >> n && n > 0)
{
ll m;
for(i=1; i<=n; i++)
{
cin >> m;
cout << a[m] << endl;
}
}
return 0;
}
Comments
Post a Comment