spoj apoorv and math problem


#1

include <bits/stdc++.h>

# define ll long long 
using namespace std;
void sieve(ll n)
{
    ll prod=1;
//memset(a,true,sizeof(a));
ll i;
for( i= 1 ;i*i<n; i++)
{
    if(n%i==0)
prod=((prod%1000000007)*(i%1000000007))%1000000007;
}
cout<<((prod)%1000000007*(n%1000000007))%1000000007;

}
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
	ll n;
ll tc;
cin>>tc;
while(tc--)
{

cin>>n;
sieve(n);
}
}
//THIS CODE GIVES TLE SINCE COMPLEXITY IS o(100*N^1/2)