Pagini recente » Cod sursa (job #2108600) | Cod sursa (job #1309836) | Cod sursa (job #2894347) | Cod sursa (job #2422218) | Cod sursa (job #1067586)
/*
Keep It Simple!
*/
#include<stdio.h>
#include<iostream>
#define MOD 9973
int N,X,Erastothene[80000],cnt;
bool viz[1000000];
void InitEra()
{
Erastothene[++cnt] = 2;
for(int i=3; i<=1000000; i++)
{
if(!viz[i])
{
Erastothene[++cnt] = i;
for(int j=i+i; j<=1000000; j+=i)
viz[j] = 1;
}
}
}
int put(int a,int b)
{
int r = 1;
a%=MOD;
while(b)
{
if ( b%2 )
{
r*=a;
r = r%MOD;
b--;
}
a*=a;
a = a%MOD;
b/=2;
}
return r;
}
void Solve()
{
int nrdt=0, nrd=1;
int Sm = 1;
for(int i=1;i <= cnt && 1LL*Erastothene[i]*Erastothene[i] <= X; i++)
{
if(X%Erastothene[i] == 0)
{
nrdt = 0;
while(X%Erastothene[i] == 0) { X/=Erastothene[i]; nrdt++; }
nrd *= (nrdt+1);
int ns = ( put(Erastothene[i],nrdt+1) -1 ) % MOD;
int nj = put(Erastothene[i]-1,MOD-2) % MOD;
Sm = ((( Sm*ns ) % MOD ) * nj ) % MOD;
}
}
if(X > 1)
{
nrd*=2;
Sm *= (X+1)%MOD;
}
printf("%d %d\n",nrd,Sm%MOD);
}
int main()
{
freopen("ssnd.in","r",stdin);
freopen("ssnd.out","w",stdout);
scanf("%d",&N);
InitEra();
for(int i=1; i<=N; i++)
{
scanf("%d",&X);
Solve();
}
}