Pagini recente » Cod sursa (job #2256662) | Cod sursa (job #1350611) | Cod sursa (job #1540412) | Cod sursa (job #1590672) | Cod sursa (job #1067588)
/*
Keep It Simple!
*/
#include<stdio.h>
#include<iostream>
#define MOD 9973
#define Max 1000003
long long X;
int N,Erastothene[80000],cnt;
bool viz[Max];
void InitEra()
{
Erastothene[++cnt] = 2;
for(int i=3; i<=Max; i+=2)
{
if(!viz[i])
{
Erastothene[++cnt] = i;
for(int j=i+i; j<=Max; 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 = (1LL * Sm * (X+1) % MOD);
}
printf("%d %d\n",nrd,Sm);
}
int main()
{
freopen("ssnd.in","r",stdin);
freopen("ssnd.out","w",stdout);
scanf("%d",&N);
InitEra();
for(int i=1; i<=N; i++)
{
scanf("%lld",&X);
Solve();
}
}