Pagini recente » Cod sursa (job #964447) | Cod sursa (job #975827) | Cod sursa (job #1355335) | Cod sursa (job #2726142) | Cod sursa (job #578951)
Cod sursa(job #578951)
#include <cstdio>
#define mult 1000005
#define mod 9973
using namespace std;
FILE *fin=freopen("ssnd.in","r",stdin);
FILE *fout=freopen("ssnd.out","w",stdout);
int t,k;
int div,e[mult],s[mult];
long long x;
void eratostene()
{
for(int i=2;i<mult;++i)
if(e[i]==0)
{
s[++k]=i;
for(int j=i+i;j<mult;j+=i)
e[j]=1;
}
}
int pow(int x, int p)
{
int r=1;
x%=mod;
for(;p;p>>=1)
{
if(p&1)
{
r*=x;
r%=mod;
}
x*=x;
x%=mod;
}
return r;
}
void solve(int n)
{
int nr=1,sdiv=1;
for(int i=1;i<=k && 1LL *s[i]*s[i]<=n;++i)
{
if(n%s[i])
continue;
int p=0;
while(n%s[i]==0)
{
n/=s[i];
++p;
}
nr*=(p+1);
int p1=(pow(s[i],p+1)-1)%mod;
int p2=pow(s[i]-1,mod-2)%mod;
sdiv=(((sdiv*p1)%mod)*p2)%mod;
}
if(n>1)
{
nr<<=1;
sdiv=(1LL*sdiv*(n+1)%mod);
}
printf("%d %d\n",nr,sdiv);
}
int main()
{
eratostene();
scanf("%d\n",&t);
while(t--)
{
scanf("%lld\n",&x);
solve(x);
}
return 0;
}