Pagini recente » Cod sursa (job #2417761) | Cod sursa (job #430029) | Cod sursa (job #855327) | Cod sursa (job #995397) | Cod sursa (job #1067582)
/*
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; j<=1000000; j+=i)
viz[j] = 1;
}
}
}
int put(int a,int b)
{
int r = 1;
while(b)
{
if ( b%2 )
{
r*=a%MOD;
b--;
}
a*=a%MOD;
b/=2;
}
return r;
}
void Solve()
{
int nrdt=0, nrd=1;
int ns=1,nj=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);
ns *= ( put(Erastothene[i],nrdt+1) -1 ) %MOD;
nj *= (Erastothene[i]-1) % MOD;
}
}
if(X > 1)
{
nrd*=2;
ns *= (X+1)%MOD;
}
printf("%d %d\n",nrd,ns/nj);
}
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();
}
}